├── .all-contributorsrc ├── .changeset ├── README.md ├── config.json ├── plenty-spies-dream.md ├── pretty-plants-chew.md └── seven-pumpkins-relate.md ├── .editorconfig ├── .github └── workflows │ ├── changeset-version.yml │ ├── ci.yml │ └── deploy.yml ├── .gitignore ├── .gitmodules ├── .husky ├── commit-msg └── pre-commit ├── .npmrc ├── .prettierignore ├── .prettierrc ├── .umirc.ts ├── .workflow ├── branch-pipeline.yml ├── master-pipeline.yml └── pr-pipeline.yml ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── docs ├── README.en-US.md ├── README.md ├── blog │ └── README.md ├── components │ ├── README.md │ ├── d-a-d.md │ ├── d-form.md │ ├── gesture-password.md │ └── list-view.md ├── docs │ ├── README.md │ ├── README.zh-CN.md │ ├── api │ │ ├── dva-api.md │ │ ├── layout-api.md │ │ ├── model-api.md │ │ ├── other-api.md │ │ ├── request-api.md │ │ └── route-api.md │ ├── component │ │ └── component.md │ ├── config │ │ ├── config.md │ │ └── runtime-config.md │ ├── guides │ │ ├── alita-layout copy.md │ │ ├── alita-layout.md │ │ ├── boilerplate.md │ │ ├── commands.md │ │ ├── deployment.md │ │ ├── directory-structure.md │ │ ├── env-variables.md │ │ ├── generator.md │ │ ├── helmet.md │ │ ├── locale.md │ │ ├── mock.md │ │ ├── native.md │ │ ├── prepare.md │ │ ├── proxy.md │ │ ├── request.md │ │ ├── route.md │ │ └── tabs.md │ ├── introduce │ │ ├── introduce.md │ │ └── upgrade-to-alita-3.md │ └── tutorials │ │ └── getting-started.md └── locales │ └── zh-CN.json ├── examples ├── a-class │ ├── package.json │ └── src │ │ └── pages │ │ └── index │ │ └── index.tsx ├── alita2 │ ├── config │ │ └── config.ts │ ├── mock │ │ └── app.ts │ ├── package.json │ ├── src │ │ ├── app.ts │ │ ├── assets │ │ │ ├── demoIcon │ │ │ │ ├── home.png │ │ │ │ ├── home1.png │ │ │ │ ├── list.png │ │ │ │ ├── list1.png │ │ │ │ ├── setting.png │ │ │ │ └── setting1.png │ │ │ └── logo.png │ │ ├── global.less │ │ ├── models │ │ │ ├── index.ts │ │ │ ├── list.ts │ │ │ └── settings.ts │ │ ├── pages │ │ │ ├── index │ │ │ │ ├── index.less │ │ │ │ └── index.tsx │ │ │ ├── list │ │ │ │ ├── a │ │ │ │ │ ├── index.less │ │ │ │ │ └── index.tsx │ │ │ │ ├── index.less │ │ │ │ └── index.tsx │ │ │ └── settings │ │ │ │ ├── index.less │ │ │ │ └── index.tsx │ │ └── services │ │ │ └── api.ts │ ├── tsconfig.json │ └── typings.d.ts ├── boilerplate │ ├── .env │ ├── .gitignore │ ├── config │ │ ├── config.cloud.ts │ │ └── config.ts │ ├── e2e │ │ └── boilerplate.test.ts │ ├── mock │ │ └── app.ts │ ├── package.json │ ├── playwright.config.ts │ ├── plugin.ts │ ├── src │ │ ├── app.tsx │ │ ├── assets │ │ │ ├── demoIcon │ │ │ │ ├── home.png │ │ │ │ ├── home1.png │ │ │ │ ├── list.png │ │ │ │ ├── list1.png │ │ │ │ ├── setting.png │ │ │ │ └── setting1.png │ │ │ └── logo.png │ │ ├── favicon.ico │ │ ├── layouts │ │ │ └── layout.tsx │ │ ├── models │ │ │ ├── index.ts │ │ │ └── todo.ts │ │ ├── pages │ │ │ ├── foo │ │ │ │ └── $index.tsx │ │ │ ├── global.less │ │ │ ├── index │ │ │ │ ├── index.less │ │ │ │ └── index.tsx │ │ │ └── users │ │ │ │ └── index.tsx │ │ └── services │ │ │ └── api.ts │ ├── tsconfig.json │ └── typings.d.ts ├── extends-app │ ├── .gitignore │ ├── config │ │ └── config.ts │ ├── mock │ │ └── app.ts │ ├── package.json │ ├── root │ │ └── pages │ │ │ └── index │ │ │ ├── index.less │ │ │ └── index.tsx │ ├── src │ │ ├── app.tsx │ │ ├── assets │ │ │ └── demoIcon │ │ │ │ ├── home.png │ │ │ │ ├── home1.png │ │ │ │ ├── list.png │ │ │ │ └── list1.png │ │ ├── models │ │ │ ├── index.ts │ │ │ └── todo.ts │ │ ├── pages │ │ │ ├── global.less │ │ │ └── index │ │ │ │ ├── index.less │ │ │ │ └── index.tsx │ │ └── services │ │ │ └── api.ts │ ├── tsconfig.json │ └── typings.d.ts ├── helmet │ ├── package.json │ ├── src │ │ └── pages │ │ │ └── index.tsx │ ├── tsconfig.json │ └── typings.d.ts ├── init-state │ ├── config │ │ └── config.ts │ ├── mock │ │ └── app.ts │ ├── package.json │ ├── src │ │ ├── app.ts │ │ ├── pages │ │ │ └── index.tsx │ │ └── services │ │ │ └── api.ts │ ├── tsconfig.json │ └── typings.d.ts ├── legacy │ ├── .env │ ├── .gitignore │ ├── config │ │ ├── config.cloud.ts │ │ └── config.ts │ ├── mock │ │ └── app.ts │ ├── package.json │ ├── plugin.ts │ ├── src │ │ ├── app.tsx │ │ ├── assets │ │ │ ├── demoIcon │ │ │ │ ├── home.png │ │ │ │ ├── home1.png │ │ │ │ ├── list.png │ │ │ │ ├── list1.png │ │ │ │ ├── setting.png │ │ │ │ └── setting1.png │ │ │ └── logo.png │ │ ├── models │ │ │ ├── index.ts │ │ │ └── todo.ts │ │ ├── pages │ │ │ ├── foo │ │ │ │ └── $index.tsx │ │ │ ├── global.less │ │ │ ├── index │ │ │ │ ├── index.less │ │ │ │ └── index.tsx │ │ │ └── users │ │ │ │ └── index.tsx │ │ └── services │ │ │ └── api.ts │ ├── tsconfig.json │ └── typings.d.ts ├── lint │ ├── .eslintrc.js │ ├── .stylelintrc.js │ ├── package.json │ └── src │ │ ├── cssinjs.js │ │ ├── test.js │ │ ├── test.less │ │ └── test.ts ├── locale │ ├── config │ │ └── config.ts │ ├── package.json │ ├── src │ │ ├── locales │ │ │ ├── en-US.ts │ │ │ └── zh-CN.ts │ │ └── pages │ │ │ ├── a.tsx │ │ │ └── index.tsx │ ├── tsconfig.json │ └── typings.d.ts ├── mako │ ├── .env │ ├── config │ │ └── config.ts │ ├── e2e │ │ └── mako.test.ts │ ├── package.json │ ├── playwright.config.ts │ ├── src │ │ └── pages │ │ │ └── index │ │ │ └── index.tsx │ ├── tsconfig.json │ └── typings.d.ts ├── min │ ├── README.md │ ├── config │ │ └── config.ts │ ├── package.json │ ├── src │ │ └── pages │ │ │ └── index │ │ │ └── index.tsx │ └── tsconfig.json ├── mobile2 │ ├── .gitignore │ ├── .umirc.ts │ ├── mock │ │ └── app.ts │ ├── package.json │ ├── plugin.ts │ ├── src │ │ ├── app.tsx │ │ ├── assets │ │ │ ├── demoIcon │ │ │ │ ├── home.png │ │ │ │ ├── home1.png │ │ │ │ ├── list.png │ │ │ │ ├── list1.png │ │ │ │ ├── setting.png │ │ │ │ └── setting1.png │ │ │ └── logo.png │ │ ├── models │ │ │ ├── index.ts │ │ │ └── todo.ts │ │ ├── pages │ │ │ ├── foo │ │ │ │ └── index.tsx │ │ │ ├── global.less │ │ │ ├── index │ │ │ │ ├── index.less │ │ │ │ └── index.tsx │ │ │ └── users │ │ │ │ └── index.tsx │ │ └── services │ │ │ └── api.ts │ ├── tsconfig.json │ └── typings.d.ts ├── mobile5 │ ├── .env │ ├── .gitignore │ ├── config │ │ ├── config.cloud.ts │ │ └── config.ts │ ├── mock │ │ └── app.ts │ ├── package.json │ ├── plugin.ts │ ├── src │ │ ├── app.tsx │ │ ├── assets │ │ │ ├── demoIcon │ │ │ │ ├── home.png │ │ │ │ ├── home1.png │ │ │ │ ├── list.png │ │ │ │ ├── list1.png │ │ │ │ ├── setting.png │ │ │ │ └── setting1.png │ │ │ └── logo.png │ │ ├── models │ │ │ ├── index.ts │ │ │ └── todo.ts │ │ ├── pages │ │ │ ├── foo │ │ │ │ └── $index.tsx │ │ │ ├── global.less │ │ │ ├── index │ │ │ │ ├── index.less │ │ │ │ └── index.tsx │ │ │ └── users │ │ │ │ └── index.tsx │ │ └── services │ │ │ └── api.ts │ ├── tsconfig.json │ └── typings.d.ts ├── mobilev2 │ ├── .gitignore │ ├── .umirc.ts │ ├── mock │ │ └── app.ts │ ├── package.json │ ├── plugin.ts │ ├── src │ │ ├── app.tsx │ │ ├── assets │ │ │ ├── demoIcon │ │ │ │ ├── home.png │ │ │ │ ├── home1.png │ │ │ │ ├── list.png │ │ │ │ ├── list1.png │ │ │ │ ├── setting.png │ │ │ │ └── setting1.png │ │ │ └── logo.png │ │ ├── models │ │ │ ├── index.ts │ │ │ └── todo.ts │ │ ├── pages │ │ │ ├── foo │ │ │ │ └── index.tsx │ │ │ ├── global.less │ │ │ ├── index │ │ │ │ ├── index.less │ │ │ │ └── index.tsx │ │ │ └── users │ │ │ │ └── index.tsx │ │ └── services │ │ │ └── api.ts │ ├── tsconfig.json │ └── typings.d.ts ├── native │ ├── .gitignore │ ├── capacitor.config.ts │ ├── config │ │ └── config.ts │ ├── ios │ │ ├── .gitignore │ │ └── App │ │ │ ├── App.xcodeproj │ │ │ ├── project.pbxproj │ │ │ └── project.xcworkspace │ │ │ │ └── contents.xcworkspacedata │ │ │ ├── App.xcworkspace │ │ │ ├── contents.xcworkspacedata │ │ │ └── xcshareddata │ │ │ │ └── IDEWorkspaceChecks.plist │ │ │ ├── App │ │ │ ├── AppDelegate.swift │ │ │ ├── Assets.xcassets │ │ │ │ ├── AppIcon.appiconset │ │ │ │ │ ├── AppIcon-20x20@1x.png │ │ │ │ │ ├── AppIcon-20x20@2x-1.png │ │ │ │ │ ├── AppIcon-20x20@2x.png │ │ │ │ │ ├── AppIcon-20x20@3x.png │ │ │ │ │ ├── AppIcon-29x29@1x.png │ │ │ │ │ ├── AppIcon-29x29@2x-1.png │ │ │ │ │ ├── AppIcon-29x29@2x.png │ │ │ │ │ ├── AppIcon-29x29@3x.png │ │ │ │ │ ├── AppIcon-40x40@1x.png │ │ │ │ │ ├── AppIcon-40x40@2x-1.png │ │ │ │ │ ├── AppIcon-40x40@2x.png │ │ │ │ │ ├── AppIcon-40x40@3x.png │ │ │ │ │ ├── AppIcon-512@2x.png │ │ │ │ │ ├── AppIcon-60x60@2x.png │ │ │ │ │ ├── AppIcon-60x60@3x.png │ │ │ │ │ ├── AppIcon-76x76@1x.png │ │ │ │ │ ├── AppIcon-76x76@2x.png │ │ │ │ │ ├── AppIcon-83.5x83.5@2x.png │ │ │ │ │ └── Contents.json │ │ │ │ ├── Contents.json │ │ │ │ └── Splash.imageset │ │ │ │ │ ├── Contents.json │ │ │ │ │ ├── splash-2732x2732-1.png │ │ │ │ │ ├── splash-2732x2732-2.png │ │ │ │ │ └── splash-2732x2732.png │ │ │ ├── Base.lproj │ │ │ │ ├── LaunchScreen.storyboard │ │ │ │ └── Main.storyboard │ │ │ ├── Info.plist │ │ │ ├── capacitor.config.json │ │ │ └── config.xml │ │ │ └── Podfile │ ├── mock │ │ └── app.ts │ ├── package.json │ ├── plugin.ts │ ├── src │ │ ├── app.tsx │ │ ├── assets │ │ │ ├── demoIcon │ │ │ │ ├── home.png │ │ │ │ ├── home1.png │ │ │ │ ├── list.png │ │ │ │ ├── list1.png │ │ │ │ ├── setting.png │ │ │ │ └── setting1.png │ │ │ └── logo.png │ │ ├── models │ │ │ ├── index.ts │ │ │ └── todo.ts │ │ ├── pages │ │ │ ├── foo │ │ │ │ └── index.tsx │ │ │ ├── global.less │ │ │ ├── index │ │ │ │ ├── index.less │ │ │ │ └── index.tsx │ │ │ └── users │ │ │ │ └── index.tsx │ │ └── services │ │ │ └── api.ts │ ├── tsconfig.json │ └── typings.d.ts ├── patchClientRoutes │ ├── config │ │ └── config.ts │ ├── package.json │ ├── src │ │ ├── app.tsx │ │ ├── assets │ │ │ ├── demoIcon │ │ │ │ ├── home.png │ │ │ │ ├── home1.png │ │ │ │ ├── list.png │ │ │ │ ├── list1.png │ │ │ │ ├── setting.png │ │ │ │ └── setting1.png │ │ │ └── logo.png │ │ ├── component │ │ │ └── DPage │ │ │ │ └── index.tsx │ │ └── pages │ │ │ └── index │ │ │ └── index.tsx │ ├── tsconfig.json │ └── typings.d.ts ├── pro │ ├── config │ │ ├── config.ts │ │ ├── defaultSettings.ts │ │ ├── oneapi.json │ │ ├── proxy.ts │ │ └── routes.ts │ ├── mock │ │ ├── listTableList.ts │ │ ├── notices.ts │ │ ├── route.ts │ │ └── user.ts │ ├── package.json │ ├── plugin.ts │ ├── src │ │ ├── access.ts │ │ ├── app.tsx │ │ ├── components │ │ │ ├── Footer │ │ │ │ └── index.tsx │ │ │ ├── HeaderDropdown │ │ │ │ ├── index.less │ │ │ │ └── index.tsx │ │ │ ├── HeaderSearch │ │ │ │ ├── index.less │ │ │ │ └── index.tsx │ │ │ ├── NoticeIcon │ │ │ │ ├── NoticeIcon.tsx │ │ │ │ ├── NoticeList.less │ │ │ │ ├── NoticeList.tsx │ │ │ │ ├── index.less │ │ │ │ └── index.tsx │ │ │ ├── RightContent │ │ │ │ ├── AvatarDropdown.tsx │ │ │ │ ├── index.less │ │ │ │ └── index.tsx │ │ │ └── index.md │ │ ├── e2e │ │ │ └── baseLayout.e2e.spec.ts │ │ ├── global.less │ │ ├── global.tsx │ │ ├── locales │ │ │ ├── bn-BD.ts │ │ │ ├── bn-BD │ │ │ │ ├── component.ts │ │ │ │ ├── globalHeader.ts │ │ │ │ ├── menu.ts │ │ │ │ ├── pages.ts │ │ │ │ ├── pwa.ts │ │ │ │ ├── settingDrawer.ts │ │ │ │ └── settings.ts │ │ │ ├── en-US.ts │ │ │ ├── en-US │ │ │ │ ├── component.ts │ │ │ │ ├── globalHeader.ts │ │ │ │ ├── menu.ts │ │ │ │ ├── pages.ts │ │ │ │ ├── pwa.ts │ │ │ │ ├── settingDrawer.ts │ │ │ │ └── settings.ts │ │ │ ├── fa-IR.ts │ │ │ ├── fa-IR │ │ │ │ ├── component.ts │ │ │ │ ├── globalHeader.ts │ │ │ │ ├── menu.ts │ │ │ │ ├── pages.ts │ │ │ │ ├── pwa.ts │ │ │ │ ├── settingDrawer.ts │ │ │ │ └── settings.ts │ │ │ ├── id-ID.ts │ │ │ ├── id-ID │ │ │ │ ├── component.ts │ │ │ │ ├── globalHeader.ts │ │ │ │ ├── menu.ts │ │ │ │ ├── pages.ts │ │ │ │ ├── pwa.ts │ │ │ │ ├── settingDrawer.ts │ │ │ │ └── settings.ts │ │ │ ├── ja-JP.ts │ │ │ ├── ja-JP │ │ │ │ ├── component.ts │ │ │ │ ├── globalHeader.ts │ │ │ │ ├── menu.ts │ │ │ │ ├── pages.ts │ │ │ │ ├── pwa.ts │ │ │ │ ├── settingDrawer.ts │ │ │ │ └── settings.ts │ │ │ ├── pt-BR.ts │ │ │ ├── pt-BR │ │ │ │ ├── component.ts │ │ │ │ ├── globalHeader.ts │ │ │ │ ├── menu.ts │ │ │ │ ├── pages.ts │ │ │ │ ├── pwa.ts │ │ │ │ ├── settingDrawer.ts │ │ │ │ └── settings.ts │ │ │ ├── zh-CN.ts │ │ │ ├── zh-CN │ │ │ │ ├── component.ts │ │ │ │ ├── globalHeader.ts │ │ │ │ ├── menu.ts │ │ │ │ ├── pages.ts │ │ │ │ ├── pwa.ts │ │ │ │ ├── settingDrawer.ts │ │ │ │ └── settings.ts │ │ │ ├── zh-TW.ts │ │ │ └── zh-TW │ │ │ │ ├── component.ts │ │ │ │ ├── globalHeader.ts │ │ │ │ ├── menu.ts │ │ │ │ ├── pages.ts │ │ │ │ ├── pwa.ts │ │ │ │ ├── settingDrawer.ts │ │ │ │ └── settings.ts │ │ ├── manifest.json │ │ ├── pages │ │ │ ├── 404.tsx │ │ │ ├── Admin.tsx │ │ │ ├── TableList │ │ │ │ ├── components │ │ │ │ │ └── UpdateForm.tsx │ │ │ │ └── index.tsx │ │ │ ├── User │ │ │ │ └── Login │ │ │ │ │ ├── index.less │ │ │ │ │ └── index.tsx │ │ │ └── Welcome.tsx │ │ ├── requestErrorConfig.ts │ │ ├── service-worker.js │ │ ├── services │ │ │ ├── ant-design-pro │ │ │ │ ├── api.ts │ │ │ │ ├── index.ts │ │ │ │ ├── login.ts │ │ │ │ └── typings.d.ts │ │ │ └── swagger │ │ │ │ ├── index.ts │ │ │ │ ├── pet.ts │ │ │ │ ├── store.ts │ │ │ │ ├── typings.d.ts │ │ │ │ └── user.ts │ │ └── typings.d.ts │ └── tsconfig.json ├── rerender │ ├── package.json │ └── src │ │ └── pages │ │ └── index │ │ └── index.tsx ├── routes │ ├── .env │ ├── .gitignore │ ├── config │ │ ├── config.cloud.ts │ │ └── config.ts │ ├── mock │ │ └── app.ts │ ├── package.json │ ├── plugin.ts │ ├── src │ │ ├── app.tsx │ │ ├── assets │ │ │ ├── demoIcon │ │ │ │ ├── home.png │ │ │ │ ├── home1.png │ │ │ │ ├── list.png │ │ │ │ ├── list1.png │ │ │ │ ├── setting.png │ │ │ │ └── setting1.png │ │ │ └── logo.png │ │ ├── models │ │ │ ├── index.ts │ │ │ └── todo.ts │ │ ├── pages │ │ │ ├── foo │ │ │ │ └── $index.tsx │ │ │ ├── global.less │ │ │ ├── index │ │ │ │ ├── index.less │ │ │ │ └── index.tsx │ │ │ └── users │ │ │ │ └── index.tsx │ │ └── services │ │ │ └── api.ts │ ├── tsconfig.json │ └── typings.d.ts ├── tabs-custom │ ├── .env │ ├── .gitignore │ ├── .umirc.ts │ ├── e2e │ │ └── tabs-custom.test.ts │ ├── mock │ │ └── app.ts │ ├── package.json │ ├── playwright.config.ts │ ├── plugin.ts │ ├── src │ │ ├── app.tsx │ │ ├── assets │ │ │ └── logo.png │ │ ├── global.less │ │ ├── layouts │ │ │ └── index.tsx │ │ ├── locales │ │ │ ├── en-US.ts │ │ │ └── zh-CN.ts │ │ ├── pages │ │ │ ├── foo │ │ │ │ └── index.tsx │ │ │ ├── index.less │ │ │ ├── index.tsx │ │ │ └── users │ │ │ │ └── index.tsx │ │ └── services │ │ │ └── api.ts │ ├── tsconfig.json │ └── typings.d.ts ├── tabs-routes │ ├── .env │ ├── .gitignore │ ├── .umirc.ts │ ├── e2e │ │ └── tabs-routes.test.ts │ ├── mock │ │ └── app.ts │ ├── package.json │ ├── playwright.config.ts │ ├── plugin.ts │ ├── src │ │ ├── assets │ │ │ └── logo.png │ │ ├── layouts │ │ │ └── index.tsx │ │ ├── pages │ │ │ ├── demo1 │ │ │ │ ├── demo11 │ │ │ │ │ └── index.tsx │ │ │ │ └── demo12 │ │ │ │ │ └── index.tsx │ │ │ ├── demo2 │ │ │ │ └── demo21 │ │ │ │ │ └── demo211 │ │ │ │ │ └── index.tsx │ │ │ ├── foo │ │ │ │ └── index.tsx │ │ │ ├── index.tsx │ │ │ └── users │ │ │ │ └── index.tsx │ │ └── routes.ts │ ├── tsconfig.json │ └── typings.d.ts ├── tabs │ ├── .env │ ├── .gitignore │ ├── .umirc.ts │ ├── e2e │ │ └── tabs.test.ts │ ├── mock │ │ └── app.ts │ ├── package.json │ ├── playwright.config.ts │ ├── plugin.ts │ ├── src │ │ ├── app.tsx │ │ ├── assets │ │ │ └── logo.png │ │ ├── global.less │ │ ├── layouts │ │ │ └── index.tsx │ │ ├── locales │ │ │ ├── en-US.ts │ │ │ └── zh-CN.ts │ │ ├── pages │ │ │ ├── foo │ │ │ │ └── index.tsx │ │ │ ├── index.less │ │ │ ├── index.tsx │ │ │ ├── lowerCase │ │ │ │ └── index.tsx │ │ │ └── users │ │ │ │ └── index.tsx │ │ └── services │ │ │ └── api.ts │ ├── tsconfig.json │ └── typings.d.ts ├── test-test │ ├── .umirc.ts │ ├── CHANGELOG.md │ ├── components │ │ └── Greet │ │ │ ├── Greet.test.tsx │ │ │ ├── Greet.tsx │ │ │ ├── __snapshots__ │ │ │ └── Greet.test.tsx.snap │ │ │ └── index.ts │ ├── foo.css │ ├── foo.test.ts │ ├── jest.config.ts │ ├── package.json │ ├── pages │ │ ├── index.less │ │ └── index.tsx │ └── utils │ │ ├── reverseApiData.test.ts │ │ └── reverseApiData.ts └── with-azure │ ├── .env │ ├── .gitignore │ ├── config │ ├── config.ts │ └── pluginazure.ts │ ├── package.json │ ├── src │ ├── app.tsx │ ├── favicon.ico │ └── pages │ │ └── index │ │ ├── index.less │ │ └── index.tsx │ ├── tsconfig.json │ └── typings.d.ts ├── logo.1png.png ├── logo.png ├── package.json ├── packages ├── alita │ ├── CHANGELOG.md │ ├── README.md │ ├── assets │ │ └── bundle-status.html │ ├── bin │ │ └── alita.js │ ├── eslint.js │ ├── fixtures │ │ └── generate │ │ │ └── .gitkeep │ ├── index.d.ts │ ├── index.esm.js │ ├── index.js │ ├── package.json │ ├── prettier.js │ ├── src │ │ ├── cli.ts │ │ ├── commands │ │ │ ├── env.ts │ │ │ └── generate │ │ │ │ ├── page.test.ts │ │ │ │ └── pages.ts │ │ ├── constants.ts │ │ ├── features │ │ │ ├── alitaloading.ts │ │ │ ├── apptype.ts │ │ │ ├── compatibleMako.ts │ │ │ ├── config │ │ │ │ ├── alitaconfig.ts │ │ │ │ └── schema.ts │ │ │ ├── legacy.ts │ │ │ ├── nodeModulesTransform.ts │ │ │ └── preloading.ts │ │ ├── index.ts │ │ └── preset.ts │ ├── stylelint.js │ ├── templates │ │ └── generate │ │ │ └── page │ │ │ ├── index.less.tpl │ │ │ ├── index.tsx.tpl │ │ │ └── service.ts.tpl │ ├── test.d.ts │ ├── test.js │ └── tsconfig.json ├── autoimport │ ├── CHANGELOG.md │ ├── README.md │ ├── package.json │ ├── src │ │ ├── babelPlugin.ts │ │ ├── index.ts │ │ └── types.ts │ └── tsconfig.json ├── chalk │ ├── CHANGELOG.md │ ├── README.md │ ├── index.html │ ├── package.json │ ├── src │ │ ├── index.test.ts │ │ └── index.ts │ └── tsconfig.json ├── create-alita │ ├── CHANGELOG.md │ ├── README.md │ ├── bin │ │ └── create-alita.js │ ├── fixtures │ │ └── .gitkeep │ ├── package.json │ ├── src │ │ ├── cli.ts │ │ ├── index.test.ts │ │ └── index.ts │ ├── templates │ │ ├── app │ │ │ ├── .editorconfig.tpl │ │ │ ├── .eslintignore.tpl │ │ │ ├── .eslintrc.js │ │ │ ├── .gitignore.tpl │ │ │ ├── .npmrc.tpl │ │ │ ├── .prettierignore.tpl │ │ │ ├── .prettierrc.js.tpl │ │ │ ├── .stylelintrc.js.tpl │ │ │ ├── README.md │ │ │ ├── config │ │ │ │ └── config.ts.tpl │ │ │ ├── jest-setup.ts │ │ │ ├── jest.config.ts │ │ │ ├── logo.png │ │ │ ├── mock │ │ │ │ ├── app.ts │ │ │ │ └── user.ts │ │ │ ├── package.json.tpl │ │ │ ├── plugin.ts │ │ │ ├── src │ │ │ │ ├── app.tsx │ │ │ │ ├── assets │ │ │ │ │ ├── demoIcon │ │ │ │ │ │ ├── home.png │ │ │ │ │ │ ├── home1.png │ │ │ │ │ │ ├── list.png │ │ │ │ │ │ ├── list1.png │ │ │ │ │ │ ├── setting.png │ │ │ │ │ │ └── setting1.png │ │ │ │ │ └── yay.jpg │ │ │ │ ├── components │ │ │ │ │ └── SearchBar │ │ │ │ │ │ ├── __tests__ │ │ │ │ │ │ ├── __snapshots__ │ │ │ │ │ │ │ └── index.test.tsx.snap │ │ │ │ │ │ └── index.test.tsx │ │ │ │ │ │ ├── index.less │ │ │ │ │ │ └── index.tsx │ │ │ │ ├── favicon.ico │ │ │ │ ├── global.css │ │ │ │ ├── models │ │ │ │ │ ├── index.ts │ │ │ │ │ └── todo.ts │ │ │ │ ├── pages │ │ │ │ │ ├── index │ │ │ │ │ │ ├── index.css │ │ │ │ │ │ └── index.tsx │ │ │ │ │ └── list │ │ │ │ │ │ ├── index.less │ │ │ │ │ │ └── index.tsx │ │ │ │ └── services │ │ │ │ │ └── api.ts │ │ │ ├── tsconfig.json.tpl │ │ │ └── typings.d.ts │ │ └── plugin │ │ │ ├── .fatherrc.ts │ │ │ ├── .gitignore.tpl │ │ │ ├── .npmrc.tpl │ │ │ ├── README.md.tpl │ │ │ ├── package.json.tpl │ │ │ └── src │ │ │ └── index.ts.tpl │ └── tsconfig.json ├── flow │ ├── CHANGELOG.md │ ├── README.md │ ├── package.json │ ├── src │ │ ├── components │ │ │ ├── Content │ │ │ │ └── index.tsx │ │ │ ├── ErrorBoundary │ │ │ │ └── index.tsx │ │ │ ├── FillContainer │ │ │ │ └── index.tsx │ │ │ ├── FlexContent │ │ │ │ └── index.tsx │ │ │ ├── Footer │ │ │ │ └── index.tsx │ │ │ ├── For │ │ │ │ └── index.tsx │ │ │ ├── Header │ │ │ │ └── index.tsx │ │ │ ├── Page │ │ │ │ └── index.tsx │ │ │ ├── Show │ │ │ │ └── index.tsx │ │ │ ├── ShrinkingModule │ │ │ │ └── index.tsx │ │ │ └── Switch │ │ │ │ └── index.tsx │ │ └── index.ts │ └── tsconfig.json ├── native │ ├── .gitignore │ ├── CHANGELOG.md │ ├── README.md │ ├── package.json │ ├── src │ │ ├── index.ts │ │ └── plugins.ts │ └── tsconfig.json ├── plugin-azure │ ├── CHANGELOG.md │ ├── README.md │ ├── package.json │ ├── src │ │ ├── index.ts │ │ └── pinolog.ts │ └── tsconfig.json ├── plugin-extends-app │ ├── CHANGELOG.md │ ├── README.md │ ├── package.json │ ├── src │ │ └── index.ts │ └── tsconfig.json ├── plugin-lowcode │ ├── CHANGELOG.md │ ├── README.md │ ├── package.json │ ├── src │ │ └── index.ts │ └── tsconfig.json ├── plugins │ ├── CHANGELOG.md │ ├── README.md │ ├── compiled │ │ ├── @alitajs │ │ │ └── postcss-plugin-px2rem │ │ │ │ ├── index.js │ │ │ │ └── package.json │ │ └── vconsole │ │ │ ├── LICENSE │ │ │ ├── dist │ │ │ └── vconsole.min.d.ts │ │ │ ├── index.js │ │ │ └── package.json │ ├── package.json │ ├── src │ │ ├── aconsole.ts │ │ ├── analytics.ts │ │ ├── antd.ts │ │ ├── antdmobile.ts │ │ ├── classnames.ts │ │ ├── dva.ts │ │ ├── hd.ts │ │ ├── index.ts │ │ ├── keepalive.ts │ │ ├── mainpath.ts │ │ ├── max │ │ │ ├── initial-state.ts │ │ │ └── locale.ts │ │ ├── mobile-layout.ts │ │ ├── model.ts │ │ ├── moment.ts │ │ ├── request.ts │ │ ├── tabs-layout.ts │ │ └── utils │ │ │ ├── astUtils.ts │ │ │ ├── checkAntd.ts │ │ │ ├── checkAntdMobile.ts │ │ │ ├── getFile │ │ │ ├── fixtures │ │ │ │ └── normal │ │ │ │ │ ├── a.js │ │ │ │ │ ├── b.js │ │ │ │ │ ├── b.ts │ │ │ │ │ ├── c.css │ │ │ │ │ ├── c.less │ │ │ │ │ └── d.css │ │ │ ├── getFile.test.ts │ │ │ └── getFile.ts │ │ │ ├── modelUtils.ts │ │ │ ├── resetMainPath │ │ │ ├── resetMainPath.test.ts │ │ │ └── resetMainPath.ts │ │ │ ├── resolveProjectDep.ts │ │ │ ├── symlink.ts │ │ │ └── withTmpPath.ts │ ├── templates │ │ ├── aconsole │ │ │ ├── inspx.tpl │ │ │ └── runtime.tpl │ │ ├── alias │ │ │ ├── index.d.ts.tpl │ │ │ └── package.json.tpl │ │ ├── hd │ │ │ └── hd.tpl │ │ ├── keepalive │ │ │ ├── context.tpl │ │ │ └── runtime.tpl │ │ └── mobile-layout │ │ │ ├── layout.tpl │ │ │ ├── layout5.tpl │ │ │ └── model.tpl │ └── tsconfig.json ├── request │ ├── CHANGELOG.md │ ├── README.md │ ├── package.json │ ├── src │ │ ├── index.test.ts │ │ └── index.ts │ └── tsconfig.json └── types │ ├── CHANGELOG.md │ ├── README.md │ ├── package.json │ ├── src │ └── index.ts │ └── tsconfig.json ├── plugin.ts ├── pnpm-lock.yaml ├── pnpm-workspace.yaml ├── public ├── dingding.png ├── logo.png └── wechat.png ├── scripts ├── .internal │ ├── constants.ts │ └── utils.ts ├── bin │ └── umi-scripts.js ├── bootstrap.ts ├── bundleDeps.ts ├── changeset.ts ├── jest-turbo.ts ├── package.json ├── postinstall.ts ├── prettier-plugin │ └── index.js ├── release.ts ├── setupWebStorm.ts ├── syncTnpm.ts ├── turbo.ts └── verifyCommit.ts ├── theme.config.ts ├── todo.md ├── tsconfig.base.json ├── tsconfig.json ├── turbo.json └── workflows ├── ci.yml └── emoji-helper.yml /.changeset/README.md: -------------------------------------------------------------------------------- 1 | # Changesets 2 | 3 | Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works 4 | with multi-package repos, or single-package repos to help you version and publish your code. You can 5 | find the full documentation for it [in our repository](https://github.com/changesets/changesets) 6 | 7 | We have a quick list of common questions to get you started engaging with this project in 8 | [our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md) 9 | -------------------------------------------------------------------------------- /.changeset/plenty-spies-dream.md: -------------------------------------------------------------------------------- 1 | --- 2 | 'alita': patch 3 | --- 4 | 5 | feat: auto open url 6 | -------------------------------------------------------------------------------- /.changeset/pretty-plants-chew.md: -------------------------------------------------------------------------------- 1 | --- 2 | '@examples/tabs': patch 3 | --- 4 | 5 | 更新 tabs demo 布局 6 | -------------------------------------------------------------------------------- /.changeset/seven-pumpkins-relate.md: -------------------------------------------------------------------------------- 1 | --- 2 | '@examples/tabs': patch 3 | --- 4 | 5 | 增加国际化使用示例 6 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | indent_style = space 6 | indent_size = 2 7 | end_of_line = lf 8 | charset = utf-8 9 | trim_trailing_whitespace = true 10 | insert_final_newline = true 11 | 12 | [*.md] 13 | trim_trailing_whitespace = false 14 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /node_modules 2 | /examples/**/.mfsu 3 | /examples/**/.umi 4 | /examples/**/.umi-production 5 | /examples/**/dist 6 | /examples/**/node_modules 7 | /packages/**/node_modules 8 | /packages/**/dist 9 | /packages/**/tsconfig.tsbuildinfo 10 | /packages/**/src/**/fixtures/*/dist 11 | /packages/**/src/**/fixtures/*/.umi 12 | /packages/**/src/**/fixtures/*/.umi-production 13 | .umi 14 | .umi-production 15 | .umi-test 16 | dist 17 | .turbo 18 | .idea 19 | playwright-report -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "packages/native/templates/alita-ios"] 2 | path = packages/native/templates/alita-ios 3 | url = https://github.com/alitajs/alita-ios.git 4 | [submodule "packages/native/templates/alita-android"] 5 | path = packages/native/templates/alita-android 6 | url = https://github.com/alitajs/alita-android.git 7 | -------------------------------------------------------------------------------- /.husky/commit-msg: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . "$(dirname "$0")/_/husky.sh" 3 | 4 | npx --no-install esno scripts/verifyCommit.ts $1 5 | -------------------------------------------------------------------------------- /.husky/pre-commit: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . "$(dirname "$0")/_/husky.sh" 3 | 4 | npx --no-install lint-staged --quiet 5 | -------------------------------------------------------------------------------- /.npmrc: -------------------------------------------------------------------------------- 1 | registry=https://registry.npmjs.org/ 2 | # registry=https://registry.npmmirror.com 3 | strict-peer-dependencies=false -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .umi 3 | .umi-production 4 | dist 5 | .mfsu 6 | *.d.ts 7 | compiled 8 | *.js 9 | fixtures 10 | *.md 11 | *.yaml 12 | *.less 13 | packages/native/templates/alita-ios 14 | packages/native/templates/alita-android 15 | .turbo -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "printWidth": 80, 3 | "singleQuote": true, 4 | "trailingComma": "all", 5 | "proseWrap": "never", 6 | "overrides": [{ "files": ".prettierrc", "options": { "parser": "json" } }], 7 | "plugins": ["prettier-plugin-organize-imports"] 8 | } 9 | -------------------------------------------------------------------------------- /.umirc.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | analytics: { 3 | ga: 'G-ET6VJN7XQ8', 4 | baidu: '5a66c03cb0ae986f876184554f2b9e13', 5 | }, 6 | plugins: [ 7 | '@umijs/plugin-docs', 8 | require.resolve('./packages/plugins/src/analytics'), 9 | ], 10 | favicons: ['/logo.png'], 11 | mfsu: { strategy: 'normal' }, 12 | routePrefetch: {}, 13 | manifest: {}, 14 | conventionRoutes: { 15 | exclude: [/\/components\//], 16 | }, 17 | }; 18 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to alita 2 | 3 | ## Set up 4 | 5 | Install dev deps after git clone the repo. 6 | 7 | ```base 8 | $ pnpm i 9 | $ pnpm build 10 | $ cd examples/boilerplate 11 | $ pnpm dev 12 | ``` 13 | -------------------------------------------------------------------------------- /docs/README.en-US.md: -------------------------------------------------------------------------------- 1 | import { Hero, Features, FeatureItem } from 'umi'; 2 | 3 | -------------------------------------------------------------------------------- /docs/README.md: -------------------------------------------------------------------------------- 1 | 2 | import { Hero, Features, FeatureItem } from 'umi'; 3 | 4 | 10 | -------------------------------------------------------------------------------- /docs/blog/README.md: -------------------------------------------------------------------------------- 1 | # Blog Home 2 | -------------------------------------------------------------------------------- /docs/components/README.md: -------------------------------------------------------------------------------- 1 | import { Navigate } from 'umi'; 2 | 3 | -------------------------------------------------------------------------------- /docs/components/gesture-password.md: -------------------------------------------------------------------------------- 1 | # 手势密码 2 | 3 | 4 | 5 | ## install 6 | 7 | ```bash 8 | // npm 9 | npm install @alitajs/gesture-password-react --save 10 | 11 | // yarn 12 | yarn add @alitajs/gesture-password-react 13 | ``` 14 | 15 | ## usage 16 | 17 | ```ts 18 | import React from 'react'; 19 | import GesturePassword from '@alitajs/gesture-password-react'; 20 | 21 | export default () => { 22 | const config = { 23 | width: 375, 24 | height: 300, 25 | onChange: (data: any) => console.log(data), // get gesture password 26 | }; 27 | 28 | return ; 29 | }; 30 | ``` 31 | -------------------------------------------------------------------------------- /docs/docs/README.md: -------------------------------------------------------------------------------- 1 | import { Navigate } from 'umi'; 2 | 3 | -------------------------------------------------------------------------------- /docs/docs/README.zh-CN.md: -------------------------------------------------------------------------------- 1 | import { Navigate } from 'umi'; 2 | 3 | -------------------------------------------------------------------------------- /docs/docs/api/other-api.md: -------------------------------------------------------------------------------- 1 | ## 其他API 2 | 3 | ### useKeepOutlets 4 | 5 | 该 API 需要在src/config/config.ts中配置 `keepalive` 才可以使用。 6 | 7 | ```ts 8 | import { defineConfig } from 'alita'; 9 | 10 | export default defineConfig({ 11 | keepalive: ['/list'], 12 | }); 13 | ``` 14 | 15 | 如果你没有使用 `mobileLayout`,而是自定义的 `layout` ,即项目中存在 `src/layouts/index.tsx`。 16 | 需要使用 `useKeepOutlets` 获取到 `OutLet`,才能使用 `keepalive` 配置需要状态保持的路由。 17 | 18 | ```ts 19 | import React from 'react'; 20 | import type {FC} from 'react'; 21 | import { useKeepOutlets} from 'alita'; 22 | 23 | const Layout: FC = () => { 24 | const OutLet = useKeepOutlets(); 25 | return <>{OutLet}; 26 | }; 27 | 28 | export default Layout; 29 | ``` 30 | 31 | -------------------------------------------------------------------------------- /docs/docs/guides/deployment.md: -------------------------------------------------------------------------------- 1 | # 部署 2 | -------------------------------------------------------------------------------- /docs/docs/guides/helmet.md: -------------------------------------------------------------------------------- 1 | # Helmet 2 | 3 | 管理 HTML 文档标签(如标题、描述等) 4 | 5 | ## 用法 6 | 7 | ```tsx 8 | import { Helmet } from 'alita'; 9 | import React from 'react'; 10 | 11 | const App = () => ( 12 | <> 13 | 14 | Hello World 15 | 16 | 17 |

Hello World

18 | 19 | ); 20 | 21 | export default App; 22 | ``` -------------------------------------------------------------------------------- /docs/docs/introduce/introduce.md: -------------------------------------------------------------------------------- 1 | # Alita 框架是什么? 2 | 3 | iframe 4 | 5 | alita@1 是当时团队面临从原生开发团队到前端 h5 团队的转型期,急需要一款前端框架能够让非前端开发人员快速上手并且保质保量的完成业务开发,当时 alita 的核心和目标是专注于业务开发,我们称它为一个“面向场景化”的前端框架。 6 | 7 | alita@2 是结合了公司内部的 50+ 移动端项目需求,进行整合并构建的强制规范化的前端开发框架。结合了公司内部的js前端开发规范和多个交付团队的代码安全审核要求,在框架层提升了代码质量。最终在 alita 方案中,大到构建使用 webpack 还是 esbuild,小到敲代码使用空格还是 tab,仅通过一个 appType 来配置完成。整个框架业务无关的配置,也就仅仅是这个应用类型。 8 | 9 | 我们的理念是与业务无关的或者业务开发中的重点和难点需求,统一整合和提升到架构开发团队,“最难啃的骨头交给牙齿最硬的人”,通过不断的优化和提升整个生态和方案,不断的探索“最佳实践”,最终把技术上的提升同步到所有的项目。 10 | 11 | 如果说 alita@1 是为了徒步前行,alita@2 为了走得更远,那在 alita@3 中我们就期望在走的更稳的基础上能够跑的更快。 12 | -------------------------------------------------------------------------------- /docs/locales/zh-CN.json: -------------------------------------------------------------------------------- 1 | { 2 | "Search anything ...": "搜索任何内容 ...", 3 | "Docs": "文档", 4 | "Components": "组件", 5 | "Blog": "博客" 6 | } 7 | -------------------------------------------------------------------------------- /examples/a-class/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@examples/aclass", 3 | "private": true, 4 | "scripts": { 5 | "dev": "alita dev", 6 | "build": "alita build", 7 | "plugin": "alita plugin list", 8 | "start": "npm run dev" 9 | }, 10 | "dependencies": { 11 | "alita": "workspace:*" 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /examples/a-class/src/pages/index/index.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | export default () => { 4 | return ( 5 |
14 | Hello Alita 15 |
16 | ); 17 | }; 18 | -------------------------------------------------------------------------------- /examples/alita2/config/config.ts: -------------------------------------------------------------------------------- 1 | const isSSR = false; 2 | const isCordova = false; 3 | const outputPath = isCordova ? 'www' : 'dist'; 4 | const env = process.env.NODE_ENV; 5 | // 这里需要对应服务器地址 6 | const path = env === 'development' ? 'http://127.0.0.1:8000/' : outputPath; 7 | 8 | export default { 9 | appType: isCordova ? 'cordova' : 'h5', 10 | mobileLayout: true, 11 | hash: false, 12 | // ssr: isSSR && !isCordova ? {} : false, 13 | outputPath: outputPath, 14 | publicPath: isSSR && !isCordova ? path : './', 15 | keepalive: ['lisT'], 16 | // packageId: 'com.alita.demos', 17 | // displayName: 'alita-demos', 18 | antd: {}, 19 | // mobile5: true, 20 | aconsole: { 21 | inspx: {}, 22 | console: {}, 23 | }, 24 | }; 25 | -------------------------------------------------------------------------------- /examples/alita2/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@examples/alita2", 3 | "private": true, 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "start": "npm run dev", 8 | "dev": "alita dev", 9 | "build": "alita build" 10 | }, 11 | "keywords": [], 12 | "author": "", 13 | "license": "MIT", 14 | "dependencies": { 15 | "@alita/react": "^0.1.0", 16 | "@alitajs/dform": "3.0.0-alpha.1", 17 | "@alitajs/iframe": "^0.0.3", 18 | "@alitajs/list-view": "1.1.2", 19 | "ahooks": "^3.0.8", 20 | "alita": "workspace:*", 21 | "antd": "^4.24.1", 22 | "antd-mobile": "2.3.4", 23 | "antd-mobile-5": "^5.24.2" 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /examples/alita2/src/assets/demoIcon/home.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/examples/alita2/src/assets/demoIcon/home.png -------------------------------------------------------------------------------- /examples/alita2/src/assets/demoIcon/home1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/examples/alita2/src/assets/demoIcon/home1.png -------------------------------------------------------------------------------- /examples/alita2/src/assets/demoIcon/list.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/examples/alita2/src/assets/demoIcon/list.png -------------------------------------------------------------------------------- /examples/alita2/src/assets/demoIcon/list1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/examples/alita2/src/assets/demoIcon/list1.png -------------------------------------------------------------------------------- /examples/alita2/src/assets/demoIcon/setting.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/examples/alita2/src/assets/demoIcon/setting.png -------------------------------------------------------------------------------- /examples/alita2/src/assets/demoIcon/setting1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/examples/alita2/src/assets/demoIcon/setting1.png -------------------------------------------------------------------------------- /examples/alita2/src/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/examples/alita2/src/assets/logo.png -------------------------------------------------------------------------------- /examples/alita2/src/global.less: -------------------------------------------------------------------------------- 1 | html { 2 | --alita-safe-area-bottom: 0 !important; 3 | } 4 | -------------------------------------------------------------------------------- /examples/alita2/src/pages/index/index.less: -------------------------------------------------------------------------------- 1 | .center { 2 | font-size: 100px; 3 | } 4 | -------------------------------------------------------------------------------- /examples/alita2/src/pages/list/a/index.less: -------------------------------------------------------------------------------- 1 | .listIcon { 2 | width: 150px !important; 3 | height: 150px !important; 4 | } 5 | -------------------------------------------------------------------------------- /examples/alita2/src/pages/list/index.less: -------------------------------------------------------------------------------- 1 | .listIcon { 2 | width: 150px !important; 3 | height: 150px !important; 4 | } 5 | -------------------------------------------------------------------------------- /examples/alita2/src/pages/settings/index.less: -------------------------------------------------------------------------------- 1 | .center { 2 | color: #fff; 3 | font-size: 26px; 4 | } 5 | -------------------------------------------------------------------------------- /examples/alita2/src/services/api.ts: -------------------------------------------------------------------------------- 1 | import { request } from 'alita'; 2 | 3 | export async function query(): Promise { 4 | return request('/api/hello'); 5 | } 6 | 7 | export async function queryList(data: any): Promise { 8 | console.log(1232131221312); 9 | console.log(data); 10 | return request('/api/list', { data }); 11 | } 12 | -------------------------------------------------------------------------------- /examples/alita2/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./src/.umi/tsconfig.json" 3 | } 4 | -------------------------------------------------------------------------------- /examples/alita2/typings.d.ts: -------------------------------------------------------------------------------- 1 | declare module '*.css'; 2 | declare module '*.less'; 3 | declare module '*.scss'; 4 | declare module '*.sass'; 5 | declare module '*.svg'; 6 | declare module '*.png'; 7 | declare module '*.jpg'; 8 | declare module '*.jpeg'; 9 | declare module '*.gif'; 10 | declare module '*.bmp'; 11 | declare module '*.tiff'; 12 | declare module '*.json'; 13 | declare module 'rc-animate'; 14 | declare module 'omit.js'; 15 | declare module 'react-copy-to-clipboard'; 16 | declare module 'react-fittext'; 17 | declare module '@antv/data-set'; 18 | declare module 'nzh/cn'; 19 | -------------------------------------------------------------------------------- /examples/boilerplate/.env: -------------------------------------------------------------------------------- 1 | UMI_ENV=cloud 2 | PORT=8888 3 | -------------------------------------------------------------------------------- /examples/boilerplate/.gitignore: -------------------------------------------------------------------------------- 1 | /.env.local 2 | /.umirc.local.ts 3 | /.umirc.local.js 4 | /config/config.local.ts 5 | /config/config.local.js 6 | /src/.umi 7 | /.umi 8 | -------------------------------------------------------------------------------- /examples/boilerplate/config/config.cloud.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | aconsole: { 3 | console: {}, 4 | inspx: {}, 5 | }, 6 | mobileLayout: true, 7 | polyfill: false, 8 | hash: false, 9 | }; 10 | -------------------------------------------------------------------------------- /examples/boilerplate/config/config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'alita'; 2 | 3 | export default defineConfig({ 4 | appType: 'h5', 5 | // 这个值在 appts 中被 getKeepAlive 修改 6 | keepalive: [/./], 7 | // presets: ['@kmijs/preset-bundler'], 8 | // Enable Rspack 9 | // rspack: {}, 10 | mobileLayout: true, 11 | legacyBuild: false, 12 | // mainPath:'users', 13 | mfsu: false, 14 | hash: false, 15 | reactRouter5Compat: {}, 16 | exportStatic: {}, 17 | }); 18 | -------------------------------------------------------------------------------- /examples/boilerplate/e2e/boilerplate.test.ts: -------------------------------------------------------------------------------- 1 | import { expect, test } from '@playwright/test'; 2 | 3 | test.beforeEach(async ({ page }) => { 4 | await page.goto('http://localhost:8888/'); 5 | }); 6 | 7 | test.describe('basic', () => { 8 | test('render', async ({ page }) => { 9 | await expect(page.getByText('antd mobile')).toBeVisible(); 10 | }); 11 | }); 12 | -------------------------------------------------------------------------------- /examples/boilerplate/mock/app.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | '/api/hello': { 3 | text: 'Alita', 4 | }, 5 | }; 6 | -------------------------------------------------------------------------------- /examples/boilerplate/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@examples/boilerplate", 3 | "private": true, 4 | "scripts": { 5 | "dev": "alita dev", 6 | "build": "alita build", 7 | "plugin": "alita plugin list", 8 | "test:e2e": "start-test dev :8888/__umi/api/status test:pw", 9 | "test:pw": "playwright test", 10 | "start": "npm run dev" 11 | }, 12 | "dependencies": { 13 | "@alita/flow": "workspace:*", 14 | "@kmijs/preset-bundler": "^0.0.1", 15 | "ahooks": "^3.0.8", 16 | "alita": "workspace:*", 17 | "antd-mobile": "^5.10.0" 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /examples/boilerplate/plugin.ts: -------------------------------------------------------------------------------- 1 | import { join } from 'path'; 2 | import { IApi } from 'umi'; 3 | 4 | export default (api: IApi) => { 5 | api.addLayouts(() => { 6 | return [ 7 | { 8 | id: 'custom-layout', 9 | // 这里写路径,现在是 src/component/layout 10 | // import React from 'react'; 11 | // const Layout = ({ children }) => { 12 | /// return
123{children}
; 13 | /// }; 14 | /// export default Layout; 15 | file: join(api.paths.absSrcPath, 'layouts/layout'), 16 | }, 17 | ]; 18 | }); 19 | }; 20 | -------------------------------------------------------------------------------- /examples/boilerplate/src/assets/demoIcon/home.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/examples/boilerplate/src/assets/demoIcon/home.png -------------------------------------------------------------------------------- /examples/boilerplate/src/assets/demoIcon/home1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/examples/boilerplate/src/assets/demoIcon/home1.png -------------------------------------------------------------------------------- /examples/boilerplate/src/assets/demoIcon/list.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/examples/boilerplate/src/assets/demoIcon/list.png -------------------------------------------------------------------------------- /examples/boilerplate/src/assets/demoIcon/list1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/examples/boilerplate/src/assets/demoIcon/list1.png -------------------------------------------------------------------------------- /examples/boilerplate/src/assets/demoIcon/setting.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/examples/boilerplate/src/assets/demoIcon/setting.png -------------------------------------------------------------------------------- /examples/boilerplate/src/assets/demoIcon/setting1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/examples/boilerplate/src/assets/demoIcon/setting1.png -------------------------------------------------------------------------------- /examples/boilerplate/src/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/examples/boilerplate/src/assets/logo.png -------------------------------------------------------------------------------- /examples/boilerplate/src/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/examples/boilerplate/src/favicon.ico -------------------------------------------------------------------------------- /examples/boilerplate/src/layouts/layout.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | const Layout = ({ children }) => { 4 | return
1232312213{children}
; 5 | }; 6 | 7 | export default Layout; 8 | -------------------------------------------------------------------------------- /examples/boilerplate/src/models/index.ts: -------------------------------------------------------------------------------- 1 | import { query } from '@/services/api'; 2 | import type { DvaModel } from 'alita'; 3 | 4 | export interface IndexModelState { 5 | name: string; 6 | } 7 | 8 | const IndexModel: DvaModel = { 9 | namespace: 'index', 10 | 11 | state: { 12 | name: 'Hello Alita', 13 | }, 14 | 15 | effects: { 16 | *query({ payload }, { call, put }) { 17 | const data = yield call(query, payload); 18 | yield put({ 19 | type: 'save', 20 | payload: { name: data.text }, 21 | }); 22 | }, 23 | }, 24 | reducers: { 25 | save(state, action) { 26 | return { 27 | ...state, 28 | ...action.payload, 29 | }; 30 | }, 31 | }, 32 | }; 33 | 34 | export default IndexModel; 35 | -------------------------------------------------------------------------------- /examples/boilerplate/src/models/todo.ts: -------------------------------------------------------------------------------- 1 | import { useState } from 'react'; 2 | 3 | export default function () { 4 | const [todos, setTodos] = useState(['foo', 'bar']); 5 | return { 6 | todos, 7 | setTodos, 8 | }; 9 | } 10 | -------------------------------------------------------------------------------- /examples/boilerplate/src/pages/foo/$index.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | export default () =>

user: Foo

; 4 | -------------------------------------------------------------------------------- /examples/boilerplate/src/pages/global.less: -------------------------------------------------------------------------------- 1 | a { 2 | color: green; 3 | } 4 | -------------------------------------------------------------------------------- /examples/boilerplate/src/pages/index/index.less: -------------------------------------------------------------------------------- 1 | .title { 2 | font-size: 30px; 3 | :global { 4 | .adm-button{ 5 | font-size: 30px 6 | } 7 | } 8 | } 9 | 10 | .adm-button{ 11 | font-size: 30px 12 | } -------------------------------------------------------------------------------- /examples/boilerplate/src/pages/index/index.tsx: -------------------------------------------------------------------------------- 1 | import { Button } from 'antd-mobile'; 2 | import React, { useState } from 'react'; 3 | import styles from './index.less'; 4 | export default () => { 5 | const [count, setCount] = useState(0); 6 | return ( 7 | <> 8 |
antd mobile
9 |
10 | Hello 123 11 | {Math.random()} 12 | 22 |
23 | 24 | ); 25 | }; 26 | -------------------------------------------------------------------------------- /examples/boilerplate/src/services/api.ts: -------------------------------------------------------------------------------- 1 | import { request } from '@@/plugin-request'; 2 | 3 | export async function query(): Promise { 4 | return request('/hello'); 5 | } 6 | -------------------------------------------------------------------------------- /examples/boilerplate/typings.d.ts: -------------------------------------------------------------------------------- 1 | declare module '*.css'; 2 | declare module '*.less'; 3 | declare module '*.scss'; 4 | declare module '*.sass'; 5 | declare module '*.svg'; 6 | declare module '*.png'; 7 | declare module '*.jpg'; 8 | declare module '*.jpeg'; 9 | declare module '*.gif'; 10 | declare module '*.bmp'; 11 | declare module '*.tiff'; 12 | declare module '*.json'; 13 | 14 | -------------------------------------------------------------------------------- /examples/extends-app/.gitignore: -------------------------------------------------------------------------------- 1 | /.env.local 2 | /.umirc.local.ts 3 | /.umirc.local.js 4 | /config/config.local.ts 5 | /config/config.local.js 6 | /src/.umi 7 | /.umi 8 | -------------------------------------------------------------------------------- /examples/extends-app/config/config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'alita'; 2 | 3 | export default defineConfig({ 4 | appType: 'h5', 5 | keepalive: [/./], 6 | extendsApp: { 7 | root: 'root', 8 | }, 9 | plugins: ['@alita/plugin-extends-app'], 10 | mobileLayout: true, 11 | legacyBuild: false, 12 | // mainPath:'users', 13 | mfsu: {}, 14 | hash: false, 15 | }); 16 | -------------------------------------------------------------------------------- /examples/extends-app/mock/app.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | '/api/hello': { 3 | text: 'Alita', 4 | }, 5 | }; 6 | -------------------------------------------------------------------------------- /examples/extends-app/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@examples/extends-app", 3 | "private": true, 4 | "scripts": { 5 | "dev": "alita dev", 6 | "build": "alita build", 7 | "plugin": "alita plugin list", 8 | "start": "npm run dev" 9 | }, 10 | "dependencies": { 11 | "@alita/flow": "workspace:*", 12 | "@alita/plugin-extends-app": "workspace:*", 13 | "ahooks": "^3.0.8", 14 | "alita": "workspace:*", 15 | "antd-mobile": "^5.10.0" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /examples/extends-app/root/pages/index/index.less: -------------------------------------------------------------------------------- 1 | .title { 2 | font-size: 30px; 3 | } 4 | .adm-button{ 5 | font-size: 30px 6 | } -------------------------------------------------------------------------------- /examples/extends-app/root/pages/index/index.tsx: -------------------------------------------------------------------------------- 1 | import { Button } from 'antd-mobile'; 2 | import React, { useState } from 'react'; 3 | import styles from './index.less'; 4 | export default () => { 5 | const [count, setCount] = useState(0); 6 | return ( 7 |
8 | exclude routes hello 9 | 19 |
20 | ); 21 | }; 22 | -------------------------------------------------------------------------------- /examples/extends-app/src/assets/demoIcon/home.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/examples/extends-app/src/assets/demoIcon/home.png -------------------------------------------------------------------------------- /examples/extends-app/src/assets/demoIcon/home1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/examples/extends-app/src/assets/demoIcon/home1.png -------------------------------------------------------------------------------- /examples/extends-app/src/assets/demoIcon/list.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/examples/extends-app/src/assets/demoIcon/list.png -------------------------------------------------------------------------------- /examples/extends-app/src/assets/demoIcon/list1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/examples/extends-app/src/assets/demoIcon/list1.png -------------------------------------------------------------------------------- /examples/extends-app/src/models/index.ts: -------------------------------------------------------------------------------- 1 | import { query } from '@/services/api'; 2 | import type { DvaModel } from 'alita'; 3 | 4 | export interface IndexModelState { 5 | name: string; 6 | } 7 | 8 | const IndexModel: DvaModel = { 9 | namespace: 'index', 10 | 11 | state: { 12 | name: 'Hello Alita', 13 | }, 14 | 15 | effects: { 16 | *query({ payload }, { call, put }) { 17 | const data = yield call(query, payload); 18 | yield put({ 19 | type: 'save', 20 | payload: { name: data.text }, 21 | }); 22 | }, 23 | }, 24 | reducers: { 25 | save(state, action) { 26 | return { 27 | ...state, 28 | ...action.payload, 29 | }; 30 | }, 31 | }, 32 | }; 33 | 34 | export default IndexModel; 35 | -------------------------------------------------------------------------------- /examples/extends-app/src/models/todo.ts: -------------------------------------------------------------------------------- 1 | import { useState } from 'react'; 2 | 3 | export default function () { 4 | const [todos, setTodos] = useState(['foo', 'bar']); 5 | return { 6 | todos, 7 | setTodos, 8 | }; 9 | } 10 | -------------------------------------------------------------------------------- /examples/extends-app/src/pages/global.less: -------------------------------------------------------------------------------- 1 | a { 2 | color: green; 3 | } 4 | -------------------------------------------------------------------------------- /examples/extends-app/src/pages/index/index.less: -------------------------------------------------------------------------------- 1 | .title { 2 | font-size: 30px; 3 | } 4 | .adm-button{ 5 | font-size: 30px 6 | } -------------------------------------------------------------------------------- /examples/extends-app/src/pages/index/index.tsx: -------------------------------------------------------------------------------- 1 | import { Button } from 'antd-mobile'; 2 | import React, { useState } from 'react'; 3 | import styles from './index.less'; 4 | export default () => { 5 | const [count, setCount] = useState(0); 6 | return ( 7 |
8 | Hello Alita 9 | 19 |
20 | ); 21 | }; 22 | -------------------------------------------------------------------------------- /examples/extends-app/src/services/api.ts: -------------------------------------------------------------------------------- 1 | import { request } from '@@/plugin-request'; 2 | 3 | export async function query(): Promise { 4 | return request('/hello'); 5 | } 6 | -------------------------------------------------------------------------------- /examples/extends-app/typings.d.ts: -------------------------------------------------------------------------------- 1 | declare module '*.css'; 2 | declare module '*.less'; 3 | declare module '*.scss'; 4 | declare module '*.sass'; 5 | declare module '*.svg'; 6 | declare module '*.png'; 7 | declare module '*.jpg'; 8 | declare module '*.jpeg'; 9 | declare module '*.gif'; 10 | declare module '*.bmp'; 11 | declare module '*.tiff'; 12 | declare module '*.json'; 13 | 14 | -------------------------------------------------------------------------------- /examples/helmet/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@examples/helmet", 3 | "private": true, 4 | "scripts": { 5 | "dev": "alita dev", 6 | "build": "ANALYZE=1 alita build", 7 | "plugin": "alita plugin list", 8 | "start": "npm run dev" 9 | }, 10 | "dependencies": { 11 | "alita": "workspace:*" 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /examples/helmet/src/pages/index.tsx: -------------------------------------------------------------------------------- 1 | import { Helmet } from 'alita'; 2 | import React from 'react'; 3 | 4 | const App = () => ( 5 | <> 6 | 7 | Hello World 8 | 9 | 10 |

Hello World

11 | 12 | ); 13 | 14 | export default App; 15 | -------------------------------------------------------------------------------- /examples/helmet/typings.d.ts: -------------------------------------------------------------------------------- 1 | declare module '*.css'; 2 | declare module '*.less'; 3 | declare module '*.scss'; 4 | declare module '*.sass'; 5 | declare module '*.svg'; 6 | declare module '*.png'; 7 | declare module '*.jpg'; 8 | declare module '*.jpeg'; 9 | declare module '*.gif'; 10 | declare module '*.bmp'; 11 | declare module '*.tiff'; 12 | declare module '*.json'; 13 | 14 | -------------------------------------------------------------------------------- /examples/init-state/config/config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'alita'; 2 | 3 | export default defineConfig({ 4 | initialState: {}, 5 | }); 6 | -------------------------------------------------------------------------------- /examples/init-state/mock/app.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | '/api/hello': { 3 | text: 'Alita', 4 | }, 5 | }; 6 | -------------------------------------------------------------------------------- /examples/init-state/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@examples/state", 3 | "private": true, 4 | "scripts": { 5 | "dev": "alita dev", 6 | "build": "ANALYZE=1 alita build", 7 | "start": "npm run dev" 8 | }, 9 | "dependencies": { 10 | "alita": "workspace:*" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /examples/init-state/src/app.ts: -------------------------------------------------------------------------------- 1 | import { query } from '@/services/api'; 2 | 3 | const middleware = async (ctx, next: () => void) => { 4 | console.log(ctx); 5 | // 可以在这写一些请求前做的事情 操作ctx.req 6 | await next(); 7 | 8 | // 可以在这里对响应数据做一些操作 操作ctx.res 9 | }; 10 | 11 | export const request = { 12 | prefix: '/api', 13 | method: 'get', 14 | middlewares: [middleware], 15 | errorHandler: (error) => { 16 | // 集中处理错误 17 | console.log(11111111); 18 | console.log(error); 19 | }, 20 | }; 21 | 22 | export async function getInitialState() { 23 | const initialData = await query(); 24 | console.log(initialData); 25 | return initialData; 26 | } 27 | -------------------------------------------------------------------------------- /examples/init-state/src/pages/index.tsx: -------------------------------------------------------------------------------- 1 | import { useModel } from 'alita'; 2 | 3 | export default () => { 4 | const { initialState, loading, error, refresh, setInitialState } = 5 | useModel('@@initialState'); 6 | return <>{JSON.stringify(initialState)}; 7 | }; 8 | -------------------------------------------------------------------------------- /examples/init-state/src/services/api.ts: -------------------------------------------------------------------------------- 1 | import { request } from '@@/plugin-request'; 2 | 3 | export async function query(): Promise { 4 | return request('/hello'); 5 | } 6 | -------------------------------------------------------------------------------- /examples/init-state/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./src/.umi/tsconfig.json" 3 | } 4 | -------------------------------------------------------------------------------- /examples/init-state/typings.d.ts: -------------------------------------------------------------------------------- 1 | import 'umi/typings'; -------------------------------------------------------------------------------- /examples/legacy/.env: -------------------------------------------------------------------------------- 1 | UMI_ENV=cloud 2 | -------------------------------------------------------------------------------- /examples/legacy/.gitignore: -------------------------------------------------------------------------------- 1 | /.env.local 2 | /.umirc.local.ts 3 | /.umirc.local.js 4 | /config/config.local.ts 5 | /config/config.local.js 6 | /src/.umi 7 | /.umi 8 | -------------------------------------------------------------------------------- /examples/legacy/config/config.cloud.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | appType: 'h5', 3 | aconsole: { 4 | console: {}, 5 | inspx: {}, 6 | }, 7 | mobileLayout: true, 8 | polyfill: false, 9 | // mainPath:'users', 10 | mfsu: {}, 11 | hash: false, 12 | }; 13 | -------------------------------------------------------------------------------- /examples/legacy/config/config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'alita'; 2 | 3 | export default defineConfig({ 4 | appType: 'h5', 5 | // 这个值在 appts 中被 getKeepAlive 修改 6 | keepalive: [/./], 7 | mobileLayout: true, 8 | // mainPath:'users', 9 | mfsu: {}, 10 | hash: false, 11 | }); 12 | -------------------------------------------------------------------------------- /examples/legacy/mock/app.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | '/api/hello': { 3 | text: 'Alita', 4 | }, 5 | }; 6 | -------------------------------------------------------------------------------- /examples/legacy/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@examples/legacy", 3 | "private": true, 4 | "scripts": { 5 | "dev": "alita dev", 6 | "build": "alita build", 7 | "plugin": "alita plugin list", 8 | "start": "npm run dev" 9 | }, 10 | "dependencies": { 11 | "@alita/flow": "workspace:*", 12 | "ahooks": "^3.0.8", 13 | "alita": "workspace:*", 14 | "antd-mobile": "^5.10.0" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /examples/legacy/plugin.ts: -------------------------------------------------------------------------------- 1 | import { IApi } from 'umi'; 2 | 3 | export default (api: IApi) => { 4 | api.onDevCompileDone((opts) => { 5 | opts; 6 | // console.log('> onDevCompileDone', opts.isFirstCompile); 7 | }); 8 | api.onBuildComplete((opts) => { 9 | opts; 10 | // console.log('> onBuildComplete', opts.isFirstCompile); 11 | }); 12 | }; 13 | -------------------------------------------------------------------------------- /examples/legacy/src/assets/demoIcon/home.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/examples/legacy/src/assets/demoIcon/home.png -------------------------------------------------------------------------------- /examples/legacy/src/assets/demoIcon/home1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/examples/legacy/src/assets/demoIcon/home1.png -------------------------------------------------------------------------------- /examples/legacy/src/assets/demoIcon/list.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/examples/legacy/src/assets/demoIcon/list.png -------------------------------------------------------------------------------- /examples/legacy/src/assets/demoIcon/list1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/examples/legacy/src/assets/demoIcon/list1.png -------------------------------------------------------------------------------- /examples/legacy/src/assets/demoIcon/setting.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/examples/legacy/src/assets/demoIcon/setting.png -------------------------------------------------------------------------------- /examples/legacy/src/assets/demoIcon/setting1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/examples/legacy/src/assets/demoIcon/setting1.png -------------------------------------------------------------------------------- /examples/legacy/src/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/examples/legacy/src/assets/logo.png -------------------------------------------------------------------------------- /examples/legacy/src/models/index.ts: -------------------------------------------------------------------------------- 1 | import { query } from '@/services/api'; 2 | import type { DvaModel } from 'alita'; 3 | 4 | export interface IndexModelState { 5 | name: string; 6 | } 7 | 8 | const IndexModel: DvaModel = { 9 | namespace: 'index', 10 | 11 | state: { 12 | name: 'Hello Alita', 13 | }, 14 | 15 | effects: { 16 | *query({ payload }, { call, put }) { 17 | const data = yield call(query, payload); 18 | yield put({ 19 | type: 'save', 20 | payload: { name: data.text }, 21 | }); 22 | }, 23 | }, 24 | reducers: { 25 | save(state, action) { 26 | return { 27 | ...state, 28 | ...action.payload, 29 | }; 30 | }, 31 | }, 32 | }; 33 | 34 | export default IndexModel; 35 | -------------------------------------------------------------------------------- /examples/legacy/src/models/todo.ts: -------------------------------------------------------------------------------- 1 | import { useState } from 'react'; 2 | 3 | export default function () { 4 | const [todos, setTodos] = useState(['foo', 'bar']); 5 | return { 6 | todos, 7 | setTodos, 8 | }; 9 | } 10 | -------------------------------------------------------------------------------- /examples/legacy/src/pages/foo/$index.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | export default () =>

user: Foo

; 4 | -------------------------------------------------------------------------------- /examples/legacy/src/pages/global.less: -------------------------------------------------------------------------------- 1 | a { 2 | color: green; 3 | } 4 | -------------------------------------------------------------------------------- /examples/legacy/src/pages/index/index.less: -------------------------------------------------------------------------------- 1 | .title { 2 | font-size: 30px; 3 | } 4 | .adm-button{ 5 | font-size: 30px 6 | } -------------------------------------------------------------------------------- /examples/legacy/src/pages/index/index.tsx: -------------------------------------------------------------------------------- 1 | import { Button } from 'antd-mobile'; 2 | import React, { useState } from 'react'; 3 | import styles from './index.less'; 4 | export default () => { 5 | const [count, setCount] = useState(0); 6 | return ( 7 |
8 | Hello Alita 9 | 19 |
20 | ); 21 | }; 22 | -------------------------------------------------------------------------------- /examples/legacy/src/services/api.ts: -------------------------------------------------------------------------------- 1 | import { request } from '@@/plugin-request'; 2 | 3 | export async function query(): Promise { 4 | return request('/hello'); 5 | } 6 | -------------------------------------------------------------------------------- /examples/legacy/typings.d.ts: -------------------------------------------------------------------------------- 1 | declare module '*.css'; 2 | declare module '*.less'; 3 | declare module '*.scss'; 4 | declare module '*.sass'; 5 | declare module '*.svg'; 6 | declare module '*.png'; 7 | declare module '*.jpg'; 8 | declare module '*.jpeg'; 9 | declare module '*.gif'; 10 | declare module '*.bmp'; 11 | declare module '*.tiff'; 12 | declare module '*.json'; 13 | 14 | -------------------------------------------------------------------------------- /examples/lint/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | extends: require.resolve('alita/eslint') 3 | } 4 | -------------------------------------------------------------------------------- /examples/lint/.stylelintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | extends: require.resolve('alita/stylelint') 3 | } 4 | -------------------------------------------------------------------------------- /examples/lint/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@example/lint", 3 | "private": true, 4 | "scripts": { 5 | "lint": "alita lint", 6 | "lint:cssinjs": "alita lint --stylelint-only --cssinjs", 7 | "lint:es": "alita lint --eslint-only", 8 | "lint:es-fix": "alita lint --eslint-only --fix", 9 | "lint:style": "alita lint --stylelint-only", 10 | "lint:style-fix": "alita lint --stylelint-only --fix", 11 | "start": "npm run dev" 12 | }, 13 | "dependencies": {}, 14 | "devDependencies": { 15 | "alita": "workspace:*" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /examples/lint/src/cssinjs.js: -------------------------------------------------------------------------------- 1 | const StyledH1 = styled.h1` 2 | font-siz: 2re; 3 | `; 4 | -------------------------------------------------------------------------------- /examples/lint/src/test.js: -------------------------------------------------------------------------------- 1 | var a = 1; 2 | -------------------------------------------------------------------------------- /examples/lint/src/test.less: -------------------------------------------------------------------------------- 1 | body { 2 | unknown: 1; 3 | } 4 | -------------------------------------------------------------------------------- /examples/lint/src/test.ts: -------------------------------------------------------------------------------- 1 | var a = 1; 2 | -------------------------------------------------------------------------------- /examples/locale/config/config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'alita'; 2 | 3 | export default defineConfig({ 4 | locale: { 5 | // 如果开启 antd 需要在项目中安装 antd· 6 | antd: false, 7 | // 默认使用 src/locales/zh-CN.ts 作为多语言文件 8 | default: 'zh-CN', 9 | baseSeparator: '-', 10 | }, 11 | }); 12 | -------------------------------------------------------------------------------- /examples/locale/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@examples/locale", 3 | "private": true, 4 | "scripts": { 5 | "dev": "alita dev", 6 | "build": "ANALYZE=1 alita build", 7 | "start": "npm run dev" 8 | }, 9 | "dependencies": { 10 | "alita": "workspace:*" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /examples/locale/src/locales/en-US.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | welcome: "Welcome to Umi's world!", 3 | }; 4 | -------------------------------------------------------------------------------- /examples/locale/src/locales/zh-CN.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | welcome: '欢迎光临 Umi 的世界!', 3 | }; 4 | -------------------------------------------------------------------------------- /examples/locale/src/pages/a.tsx: -------------------------------------------------------------------------------- 1 | import { useIntl } from 'alita'; 2 | 3 | export default () => { 4 | const intl = useIntl(); 5 | const msg = intl.formatMessage({ 6 | id: 'welcome', 7 | }); 8 | 9 | return <>{msg}; 10 | }; 11 | -------------------------------------------------------------------------------- /examples/locale/src/pages/index.tsx: -------------------------------------------------------------------------------- 1 | import { FormattedMessage, getLocale, setLocale } from 'alita'; 2 | import A from './a'; 3 | 4 | const App = () => ( 5 | <> 6 | 7 | 8 | 16 | 17 | ); 18 | 19 | export default App; 20 | -------------------------------------------------------------------------------- /examples/locale/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./src/.umi/tsconfig.json" 3 | } 4 | -------------------------------------------------------------------------------- /examples/locale/typings.d.ts: -------------------------------------------------------------------------------- 1 | import 'umi/typings'; -------------------------------------------------------------------------------- /examples/mako/.env: -------------------------------------------------------------------------------- 1 | PORT=9999 2 | -------------------------------------------------------------------------------- /examples/mako/config/config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'alita'; 2 | 3 | export default defineConfig({ 4 | appType: 'pc', 5 | mako: {}, 6 | // 开了 mako 就要关 codeSplitting !!! 7 | codeSplitting: false, 8 | }); 9 | -------------------------------------------------------------------------------- /examples/mako/e2e/mako.test.ts: -------------------------------------------------------------------------------- 1 | import { expect, test } from '@playwright/test'; 2 | 3 | test.beforeEach(async ({ page }) => { 4 | await page.goto('http://localhost:9999/'); 5 | }); 6 | 7 | test.describe('basic', () => { 8 | test('render', async ({ page }) => { 9 | await expect(page.getByText('Hello Mako')).toBeVisible(); 10 | }); 11 | }); 12 | -------------------------------------------------------------------------------- /examples/mako/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@examples/mako", 3 | "private": true, 4 | "scripts": { 5 | "dev": "alita dev", 6 | "build": "alita build", 7 | "plugin": "alita plugin list", 8 | "test:e2e": "start-test dev :9999/__umi/api/status test:pw", 9 | "test:pw": "playwright test", 10 | "start": "npm run dev" 11 | }, 12 | "dependencies": { 13 | "alita": "workspace:*" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /examples/mako/src/pages/index/index.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | export default () => { 4 | return
Hello Mako
; 5 | }; 6 | -------------------------------------------------------------------------------- /examples/mako/typings.d.ts: -------------------------------------------------------------------------------- 1 | declare module '*.css'; 2 | declare module '*.less'; 3 | declare module '*.scss'; 4 | declare module '*.sass'; 5 | declare module '*.svg'; 6 | declare module '*.png'; 7 | declare module '*.jpg'; 8 | declare module '*.jpeg'; 9 | declare module '*.gif'; 10 | declare module '*.bmp'; 11 | declare module '*.tiff'; 12 | declare module '*.json'; 13 | 14 | -------------------------------------------------------------------------------- /examples/min/config/config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'alita'; 2 | 3 | export default defineConfig({ 4 | appType: 'pc', 5 | // for ie 6 | // legacyBuild: false, 7 | moment2dayjs: false, 8 | // @ts-ignore 9 | // for ie 10 | // headScripts: [ 11 | // 'https://unpkg.com/react@18.1.0/umd/react.production.min.js', 12 | // 'https://unpkg.com/react-dom@18.1.0/umd/react-dom.production.min.js', 13 | // ], 14 | // for ie 15 | // externals: { react: 'React', 'react-dom': 'ReactDOM' }, 16 | // @ts-ignore 17 | dva: false, 18 | // @ts-ignore 19 | model: false, 20 | }); 21 | -------------------------------------------------------------------------------- /examples/min/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@examples/min", 3 | "private": true, 4 | "scripts": { 5 | "dev": "alita dev", 6 | "build": "ANALYZE=1 alita build", 7 | "start": "npm run dev" 8 | }, 9 | "dependencies": { 10 | "alita": "workspace:*" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /examples/min/src/pages/index/index.tsx: -------------------------------------------------------------------------------- 1 | export default () => { 2 | return <>Alita; 3 | }; 4 | -------------------------------------------------------------------------------- /examples/min/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./src/.umi/tsconfig.json" 3 | } 4 | -------------------------------------------------------------------------------- /examples/mobile2/.gitignore: -------------------------------------------------------------------------------- 1 | /.env.local 2 | /.umirc.local.ts 3 | /.umirc.local.js 4 | /config/config.local.ts 5 | /config/config.local.js 6 | /src/.umi 7 | /.umi 8 | -------------------------------------------------------------------------------- /examples/mobile2/.umirc.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'alita'; 2 | export default defineConfig({ 3 | appType: 'h5', 4 | keepalive: [/users/], 5 | aconsole: { 6 | console: {}, 7 | inspx: {}, 8 | }, 9 | // 默认配置,此处留着调试使用 10 | // jsStrategy: 'bigVendors' | 'depPerChunk' | 'granularChunks'; 11 | // codeSplitting: { 12 | // jsStrategy: 'granularChunks' 13 | // }, 14 | mobileLayout: true, 15 | polyfill: false, 16 | // mainPath:'users', 17 | mfsu: {}, 18 | hash: false, 19 | }); 20 | -------------------------------------------------------------------------------- /examples/mobile2/mock/app.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | '/api/hello': { 3 | text: 'Alita', 4 | }, 5 | }; 6 | -------------------------------------------------------------------------------- /examples/mobile2/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@examples/mobile2", 3 | "private": true, 4 | "scripts": { 5 | "dev": "alita dev", 6 | "build": "ANALYZE=1 alita build", 7 | "plugin": "alita plugin list", 8 | "start": "npm run dev" 9 | }, 10 | "dependencies": { 11 | "@alita/flow": "workspace:*", 12 | "ahooks": "^3.0.8", 13 | "alita": "workspace:*", 14 | "antd-mobile": "2.3.4" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /examples/mobile2/plugin.ts: -------------------------------------------------------------------------------- 1 | import { IApi } from 'umi'; 2 | 3 | export default (api: IApi) => { 4 | api.onDevCompileDone((opts) => { 5 | opts; 6 | // console.log('> onDevCompileDone', opts.isFirstCompile); 7 | }); 8 | api.onBuildComplete((opts) => { 9 | opts; 10 | // console.log('> onBuildComplete', opts.isFirstCompile); 11 | }); 12 | }; 13 | -------------------------------------------------------------------------------- /examples/mobile2/src/assets/demoIcon/home.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/examples/mobile2/src/assets/demoIcon/home.png -------------------------------------------------------------------------------- /examples/mobile2/src/assets/demoIcon/home1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/examples/mobile2/src/assets/demoIcon/home1.png -------------------------------------------------------------------------------- /examples/mobile2/src/assets/demoIcon/list.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/examples/mobile2/src/assets/demoIcon/list.png -------------------------------------------------------------------------------- /examples/mobile2/src/assets/demoIcon/list1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/examples/mobile2/src/assets/demoIcon/list1.png -------------------------------------------------------------------------------- /examples/mobile2/src/assets/demoIcon/setting.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/examples/mobile2/src/assets/demoIcon/setting.png -------------------------------------------------------------------------------- /examples/mobile2/src/assets/demoIcon/setting1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/examples/mobile2/src/assets/demoIcon/setting1.png -------------------------------------------------------------------------------- /examples/mobile2/src/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/examples/mobile2/src/assets/logo.png -------------------------------------------------------------------------------- /examples/mobile2/src/models/index.ts: -------------------------------------------------------------------------------- 1 | import { query } from '@/services/api'; 2 | import type { DvaModel } from 'alita'; 3 | 4 | export interface IndexModelState { 5 | name: string; 6 | } 7 | 8 | const IndexModel: DvaModel = { 9 | namespace: 'index', 10 | 11 | state: { 12 | name: 'Hello Alita', 13 | }, 14 | 15 | effects: { 16 | *query({ payload }, { call, put }) { 17 | const data = yield call(query, payload); 18 | yield put({ 19 | type: 'save', 20 | payload: { name: data.text }, 21 | }); 22 | }, 23 | }, 24 | reducers: { 25 | save(state, action) { 26 | return { 27 | ...state, 28 | ...action.payload, 29 | }; 30 | }, 31 | }, 32 | }; 33 | 34 | export default IndexModel; 35 | -------------------------------------------------------------------------------- /examples/mobile2/src/models/todo.ts: -------------------------------------------------------------------------------- 1 | import { useState } from 'react'; 2 | 3 | export default function () { 4 | const [todos, setTodos] = useState(['foo', 'bar']); 5 | return { 6 | todos, 7 | setTodos, 8 | }; 9 | } 10 | -------------------------------------------------------------------------------- /examples/mobile2/src/pages/foo/index.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | export default () =>

user: Foo

; 4 | -------------------------------------------------------------------------------- /examples/mobile2/src/pages/global.less: -------------------------------------------------------------------------------- 1 | a { 2 | color: green; 3 | } 4 | -------------------------------------------------------------------------------- /examples/mobile2/src/pages/index/index.less: -------------------------------------------------------------------------------- 1 | .title { 2 | font-size: 30px; 3 | } 4 | .adm-button{ 5 | font-size: 30px 6 | } -------------------------------------------------------------------------------- /examples/mobile2/src/pages/index/index.tsx: -------------------------------------------------------------------------------- 1 | import { history } from 'alita'; 2 | import React from 'react'; 3 | import styles from './index.less'; 4 | export default () => ( 5 |
{ 8 | history.push('/users'); 9 | }} 10 | > 11 | Hello Alita 12 |
13 | ); 14 | -------------------------------------------------------------------------------- /examples/mobile2/src/services/api.ts: -------------------------------------------------------------------------------- 1 | import { request } from '@@/plugin-request'; 2 | 3 | export async function query(): Promise { 4 | return request('/hello'); 5 | } 6 | -------------------------------------------------------------------------------- /examples/mobile2/typings.d.ts: -------------------------------------------------------------------------------- 1 | declare module '*.css'; 2 | declare module '*.less'; 3 | declare module '*.scss'; 4 | declare module '*.sass'; 5 | declare module '*.svg'; 6 | declare module '*.png'; 7 | declare module '*.jpg'; 8 | declare module '*.jpeg'; 9 | declare module '*.gif'; 10 | declare module '*.bmp'; 11 | declare module '*.tiff'; 12 | declare module '*.json'; 13 | 14 | -------------------------------------------------------------------------------- /examples/mobile5/.env: -------------------------------------------------------------------------------- 1 | UMI_ENV=cloud 2 | -------------------------------------------------------------------------------- /examples/mobile5/.gitignore: -------------------------------------------------------------------------------- 1 | /.env.local 2 | /.umirc.local.ts 3 | /.umirc.local.js 4 | /config/config.local.ts 5 | /config/config.local.js 6 | /src/.umi 7 | /.umi 8 | -------------------------------------------------------------------------------- /examples/mobile5/config/config.cloud.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | appType: 'h5', 3 | aconsole: { 4 | console: {}, 5 | inspx: {}, 6 | }, 7 | mobileLayout: true, 8 | polyfill: false, 9 | hash: false, 10 | }; 11 | -------------------------------------------------------------------------------- /examples/mobile5/config/config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'alita'; 2 | 3 | export default defineConfig({ 4 | appType: 'h5', 5 | // 这个值在 appts 中被 getKeepAlive 修改 6 | keepalive: [/./], 7 | mobileLayout: true, 8 | legacyBuild: false, 9 | // mainPath:'users', 10 | mfsu: false, 11 | hash: false, 12 | reactRouter5Compat: {}, 13 | exportStatic: {}, 14 | }); 15 | -------------------------------------------------------------------------------- /examples/mobile5/mock/app.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | '/api/hello': { 3 | text: 'Alita', 4 | }, 5 | }; 6 | -------------------------------------------------------------------------------- /examples/mobile5/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@examples/mobile5", 3 | "private": true, 4 | "scripts": { 5 | "dev": "alita dev", 6 | "build": "alita build", 7 | "plugin": "alita plugin list", 8 | "start": "npm run dev" 9 | }, 10 | "dependencies": { 11 | "@alita/flow": "workspace:*", 12 | "ahooks": "^3.0.8", 13 | "alita": "workspace:*", 14 | "antd-mobile-5": "5.24.2" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /examples/mobile5/plugin.ts: -------------------------------------------------------------------------------- 1 | import { IApi } from 'umi'; 2 | 3 | export default (api: IApi) => { 4 | api.onDevCompileDone((opts) => { 5 | opts; 6 | // console.log('> onDevCompileDone', opts.isFirstCompile); 7 | }); 8 | api.onBuildComplete((opts) => { 9 | opts; 10 | // console.log('> onBuildComplete', opts.isFirstCompile); 11 | }); 12 | }; 13 | -------------------------------------------------------------------------------- /examples/mobile5/src/assets/demoIcon/home.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/examples/mobile5/src/assets/demoIcon/home.png -------------------------------------------------------------------------------- /examples/mobile5/src/assets/demoIcon/home1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/examples/mobile5/src/assets/demoIcon/home1.png -------------------------------------------------------------------------------- /examples/mobile5/src/assets/demoIcon/list.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/examples/mobile5/src/assets/demoIcon/list.png -------------------------------------------------------------------------------- /examples/mobile5/src/assets/demoIcon/list1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/examples/mobile5/src/assets/demoIcon/list1.png -------------------------------------------------------------------------------- /examples/mobile5/src/assets/demoIcon/setting.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/examples/mobile5/src/assets/demoIcon/setting.png -------------------------------------------------------------------------------- /examples/mobile5/src/assets/demoIcon/setting1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/examples/mobile5/src/assets/demoIcon/setting1.png -------------------------------------------------------------------------------- /examples/mobile5/src/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/examples/mobile5/src/assets/logo.png -------------------------------------------------------------------------------- /examples/mobile5/src/models/index.ts: -------------------------------------------------------------------------------- 1 | import { query } from '@/services/api'; 2 | import type { DvaModel } from 'alita'; 3 | 4 | export interface IndexModelState { 5 | name: string; 6 | } 7 | 8 | const IndexModel: DvaModel = { 9 | namespace: 'index', 10 | 11 | state: { 12 | name: 'Hello Alita', 13 | }, 14 | 15 | effects: { 16 | *query({ payload }, { call, put }) { 17 | const data = yield call(query, payload); 18 | yield put({ 19 | type: 'save', 20 | payload: { name: data.text }, 21 | }); 22 | }, 23 | }, 24 | reducers: { 25 | save(state, action) { 26 | return { 27 | ...state, 28 | ...action.payload, 29 | }; 30 | }, 31 | }, 32 | }; 33 | 34 | export default IndexModel; 35 | -------------------------------------------------------------------------------- /examples/mobile5/src/models/todo.ts: -------------------------------------------------------------------------------- 1 | import { useState } from 'react'; 2 | 3 | export default function () { 4 | const [todos, setTodos] = useState(['foo', 'bar']); 5 | return { 6 | todos, 7 | setTodos, 8 | }; 9 | } 10 | -------------------------------------------------------------------------------- /examples/mobile5/src/pages/foo/$index.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | export default () =>

user: Foo

; 4 | -------------------------------------------------------------------------------- /examples/mobile5/src/pages/global.less: -------------------------------------------------------------------------------- 1 | a { 2 | color: green; 3 | } 4 | -------------------------------------------------------------------------------- /examples/mobile5/src/pages/index/index.less: -------------------------------------------------------------------------------- 1 | .title { 2 | font-size: 30px; 3 | :global { 4 | .adm-button{ 5 | font-size: 30px 6 | } 7 | } 8 | } 9 | 10 | .adm-button{ 11 | font-size: 30px 12 | } -------------------------------------------------------------------------------- /examples/mobile5/src/services/api.ts: -------------------------------------------------------------------------------- 1 | import { request } from '@@/plugin-request'; 2 | 3 | export async function query(): Promise { 4 | return request('/hello'); 5 | } 6 | -------------------------------------------------------------------------------- /examples/mobile5/typings.d.ts: -------------------------------------------------------------------------------- 1 | declare module '*.css'; 2 | declare module '*.less'; 3 | declare module '*.scss'; 4 | declare module '*.sass'; 5 | declare module '*.svg'; 6 | declare module '*.png'; 7 | declare module '*.jpg'; 8 | declare module '*.jpeg'; 9 | declare module '*.gif'; 10 | declare module '*.bmp'; 11 | declare module '*.tiff'; 12 | declare module '*.json'; 13 | 14 | -------------------------------------------------------------------------------- /examples/mobilev2/.gitignore: -------------------------------------------------------------------------------- 1 | /.env.local 2 | /.umirc.local.ts 3 | /.umirc.local.js 4 | /config/config.local.ts 5 | /config/config.local.js 6 | /src/.umi 7 | /.umi 8 | -------------------------------------------------------------------------------- /examples/mobilev2/.umirc.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'alita'; 2 | export default defineConfig({ 3 | appType: 'h5', 4 | keepalive: [/users/], 5 | aconsole: { 6 | console: {}, 7 | inspx: {}, 8 | }, 9 | // 默认配置,此处留着调试使用 10 | // jsStrategy: 'bigVendors' | 'depPerChunk' | 'granularChunks'; 11 | // codeSplitting: { 12 | // jsStrategy: 'granularChunks' 13 | // }, 14 | mobileLayout: true, 15 | polyfill: false, 16 | // mainPath:'users', 17 | mfsu: {}, 18 | hash: false, 19 | }); 20 | -------------------------------------------------------------------------------- /examples/mobilev2/mock/app.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | '/api/hello': { 3 | text: 'Alita', 4 | }, 5 | }; 6 | -------------------------------------------------------------------------------- /examples/mobilev2/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@examples/mobilev2", 3 | "private": true, 4 | "scripts": { 5 | "dev": "alita dev", 6 | "build": "ANALYZE=1 alita build", 7 | "plugin": "alita plugin list", 8 | "start": "npm run dev" 9 | }, 10 | "dependencies": { 11 | "@alita/flow": "workspace:*", 12 | "ahooks": "^3.0.8", 13 | "alita": "workspace:*", 14 | "antd-mobile-v2": "2.3.4" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /examples/mobilev2/plugin.ts: -------------------------------------------------------------------------------- 1 | import { IApi } from 'umi'; 2 | 3 | export default (api: IApi) => { 4 | api.onDevCompileDone((opts) => { 5 | opts; 6 | // console.log('> onDevCompileDone', opts.isFirstCompile); 7 | }); 8 | api.onBuildComplete((opts) => { 9 | opts; 10 | // console.log('> onBuildComplete', opts.isFirstCompile); 11 | }); 12 | }; 13 | -------------------------------------------------------------------------------- /examples/mobilev2/src/assets/demoIcon/home.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/examples/mobilev2/src/assets/demoIcon/home.png -------------------------------------------------------------------------------- /examples/mobilev2/src/assets/demoIcon/home1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/examples/mobilev2/src/assets/demoIcon/home1.png -------------------------------------------------------------------------------- /examples/mobilev2/src/assets/demoIcon/list.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/examples/mobilev2/src/assets/demoIcon/list.png -------------------------------------------------------------------------------- /examples/mobilev2/src/assets/demoIcon/list1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/examples/mobilev2/src/assets/demoIcon/list1.png -------------------------------------------------------------------------------- /examples/mobilev2/src/assets/demoIcon/setting.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/examples/mobilev2/src/assets/demoIcon/setting.png -------------------------------------------------------------------------------- /examples/mobilev2/src/assets/demoIcon/setting1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/examples/mobilev2/src/assets/demoIcon/setting1.png -------------------------------------------------------------------------------- /examples/mobilev2/src/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/examples/mobilev2/src/assets/logo.png -------------------------------------------------------------------------------- /examples/mobilev2/src/models/index.ts: -------------------------------------------------------------------------------- 1 | import { query } from '@/services/api'; 2 | import type { DvaModel } from 'alita'; 3 | 4 | export interface IndexModelState { 5 | name: string; 6 | } 7 | 8 | const IndexModel: DvaModel = { 9 | namespace: 'index', 10 | 11 | state: { 12 | name: 'Hello Alita', 13 | }, 14 | 15 | effects: { 16 | *query({ payload }, { call, put }) { 17 | const data = yield call(query, payload); 18 | yield put({ 19 | type: 'save', 20 | payload: { name: data.text }, 21 | }); 22 | }, 23 | }, 24 | reducers: { 25 | save(state, action) { 26 | return { 27 | ...state, 28 | ...action.payload, 29 | }; 30 | }, 31 | }, 32 | }; 33 | 34 | export default IndexModel; 35 | -------------------------------------------------------------------------------- /examples/mobilev2/src/models/todo.ts: -------------------------------------------------------------------------------- 1 | import { useState } from 'react'; 2 | 3 | export default function () { 4 | const [todos, setTodos] = useState(['foo', 'bar']); 5 | return { 6 | todos, 7 | setTodos, 8 | }; 9 | } 10 | -------------------------------------------------------------------------------- /examples/mobilev2/src/pages/foo/index.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | export default () =>

user: Foo

; 4 | -------------------------------------------------------------------------------- /examples/mobilev2/src/pages/global.less: -------------------------------------------------------------------------------- 1 | a { 2 | color: green; 3 | } 4 | -------------------------------------------------------------------------------- /examples/mobilev2/src/pages/index/index.less: -------------------------------------------------------------------------------- 1 | .title { 2 | font-size: 30px; 3 | } 4 | .adm-button{ 5 | font-size: 30px 6 | } -------------------------------------------------------------------------------- /examples/mobilev2/src/pages/index/index.tsx: -------------------------------------------------------------------------------- 1 | import { history } from 'alita'; 2 | import React from 'react'; 3 | import styles from './index.less'; 4 | export default () => ( 5 |
{ 8 | history.push('/users'); 9 | }} 10 | > 11 | Hello Alita 12 |
13 | ); 14 | -------------------------------------------------------------------------------- /examples/mobilev2/src/services/api.ts: -------------------------------------------------------------------------------- 1 | import { request } from '@@/plugin-request'; 2 | 3 | export async function query(): Promise { 4 | return request('/hello'); 5 | } 6 | -------------------------------------------------------------------------------- /examples/mobilev2/typings.d.ts: -------------------------------------------------------------------------------- 1 | declare module '*.css'; 2 | declare module '*.less'; 3 | declare module '*.scss'; 4 | declare module '*.sass'; 5 | declare module '*.svg'; 6 | declare module '*.png'; 7 | declare module '*.jpg'; 8 | declare module '*.jpeg'; 9 | declare module '*.gif'; 10 | declare module '*.bmp'; 11 | declare module '*.tiff'; 12 | declare module '*.json'; 13 | 14 | -------------------------------------------------------------------------------- /examples/native/.gitignore: -------------------------------------------------------------------------------- 1 | /.env.local 2 | /.umirc.local.ts 3 | /.umirc.local.js 4 | /config/config.local.ts 5 | /config/config.local.js 6 | /src/.umi 7 | /.umi 8 | -------------------------------------------------------------------------------- /examples/native/capacitor.config.ts: -------------------------------------------------------------------------------- 1 | import { CapacitorConfig } from '@capacitor/cli'; 2 | 3 | const config: CapacitorConfig = { 4 | appId: 'com.example.appname', 5 | appName: 'AlitaDemo', 6 | webDir: 'dist', 7 | bundledWebRuntime: false, 8 | // server: { 9 | // url: "http://127.0.0.1:8000", 10 | // cleartext: true 11 | // }, 12 | }; 13 | 14 | export default config; 15 | -------------------------------------------------------------------------------- /examples/native/config/config.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | appType: 'native', 3 | displayName: 'AlitaDemo', // The application's name 4 | packageId: 'com.example.appname', // The application's App ID; 5 | mobileLayout: true, 6 | npmClient: 'pnpm', 7 | }; 8 | -------------------------------------------------------------------------------- /examples/native/ios/.gitignore: -------------------------------------------------------------------------------- 1 | App/build 2 | App/Pods 3 | App/Podfile.lock 4 | App/App/public 5 | DerivedData 6 | xcuserdata 7 | 8 | # Cordova plugins for Capacitor 9 | capacitor-cordova-ios-plugins 10 | -------------------------------------------------------------------------------- /examples/native/ios/App/App.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /examples/native/ios/App/App.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /examples/native/ios/App/App.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /examples/native/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/examples/native/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-20x20@1x.png -------------------------------------------------------------------------------- /examples/native/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-20x20@2x-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/examples/native/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-20x20@2x-1.png -------------------------------------------------------------------------------- /examples/native/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/examples/native/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-20x20@2x.png -------------------------------------------------------------------------------- /examples/native/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/examples/native/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-20x20@3x.png -------------------------------------------------------------------------------- /examples/native/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/examples/native/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-29x29@1x.png -------------------------------------------------------------------------------- /examples/native/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-29x29@2x-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/examples/native/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-29x29@2x-1.png -------------------------------------------------------------------------------- /examples/native/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/examples/native/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-29x29@2x.png -------------------------------------------------------------------------------- /examples/native/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/examples/native/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-29x29@3x.png -------------------------------------------------------------------------------- /examples/native/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/examples/native/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-40x40@1x.png -------------------------------------------------------------------------------- /examples/native/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-40x40@2x-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/examples/native/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-40x40@2x-1.png -------------------------------------------------------------------------------- /examples/native/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/examples/native/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-40x40@2x.png -------------------------------------------------------------------------------- /examples/native/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/examples/native/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-40x40@3x.png -------------------------------------------------------------------------------- /examples/native/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-512@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/examples/native/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-512@2x.png -------------------------------------------------------------------------------- /examples/native/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/examples/native/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-60x60@2x.png -------------------------------------------------------------------------------- /examples/native/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/examples/native/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-60x60@3x.png -------------------------------------------------------------------------------- /examples/native/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/examples/native/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-76x76@1x.png -------------------------------------------------------------------------------- /examples/native/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/examples/native/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-76x76@2x.png -------------------------------------------------------------------------------- /examples/native/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/examples/native/ios/App/App/Assets.xcassets/AppIcon.appiconset/AppIcon-83.5x83.5@2x.png -------------------------------------------------------------------------------- /examples/native/ios/App/App/Assets.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info": { 3 | "version": 1, 4 | "author": "xcode" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /examples/native/ios/App/App/Assets.xcassets/Splash.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images": [ 3 | { 4 | "idiom": "universal", 5 | "filename": "splash-2732x2732-2.png", 6 | "scale": "1x" 7 | }, 8 | { 9 | "idiom": "universal", 10 | "filename": "splash-2732x2732-1.png", 11 | "scale": "2x" 12 | }, 13 | { 14 | "idiom": "universal", 15 | "filename": "splash-2732x2732.png", 16 | "scale": "3x" 17 | } 18 | ], 19 | "info": { 20 | "version": 1, 21 | "author": "xcode" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /examples/native/ios/App/App/Assets.xcassets/Splash.imageset/splash-2732x2732-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/examples/native/ios/App/App/Assets.xcassets/Splash.imageset/splash-2732x2732-1.png -------------------------------------------------------------------------------- /examples/native/ios/App/App/Assets.xcassets/Splash.imageset/splash-2732x2732-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/examples/native/ios/App/App/Assets.xcassets/Splash.imageset/splash-2732x2732-2.png -------------------------------------------------------------------------------- /examples/native/ios/App/App/Assets.xcassets/Splash.imageset/splash-2732x2732.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/examples/native/ios/App/App/Assets.xcassets/Splash.imageset/splash-2732x2732.png -------------------------------------------------------------------------------- /examples/native/ios/App/App/capacitor.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "appId": "com.example.appname", 3 | "appName": "AlitaDemo", 4 | "webDir": "dist", 5 | "bundledWebRuntime": false 6 | } 7 | -------------------------------------------------------------------------------- /examples/native/ios/App/App/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /examples/native/ios/App/Podfile: -------------------------------------------------------------------------------- 1 | platform :ios, '12.0' 2 | use_frameworks! 3 | 4 | # workaround to avoid Xcode caching of Pods that requires 5 | # Product -> Clean Build Folder after new Cordova plugins installed 6 | # Requires CocoaPods 1.6 or newer 7 | install! 'cocoapods', :disable_input_output_paths => true 8 | 9 | def capacitor_pods 10 | pod 'Capacitor', :path => '../../../../node_modules/.pnpm/@capacitor+ios@3.6.0_@capacitor+core@3.6.0/node_modules/@capacitor/ios' 11 | pod 'CapacitorCordova', :path => '../../../../node_modules/.pnpm/@capacitor+ios@3.6.0_@capacitor+core@3.6.0/node_modules/@capacitor/ios' 12 | 13 | end 14 | 15 | target 'App' do 16 | capacitor_pods 17 | # Add your Pods here 18 | end 19 | -------------------------------------------------------------------------------- /examples/native/mock/app.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | '/api/hello': { 3 | text: 'Alita', 4 | }, 5 | }; 6 | -------------------------------------------------------------------------------- /examples/native/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@examples/native", 3 | "private": true, 4 | "scripts": { 5 | "dev": "alita dev", 6 | "dev:ios": "alita native run ios", 7 | "init": "alita native init", 8 | "ios": "alita native add ios", 9 | "build": "ANALYZE=1 alita build", 10 | "plugin": "alita plugin list", 11 | "start": "npm run dev" 12 | }, 13 | "dependencies": { 14 | "@alita/flow": "workspace:*", 15 | "@alita/native": "workspace:*", 16 | "@capacitor/core": "^3.6.0", 17 | "@capacitor/ios": "^3.6.0", 18 | "ahooks": "^3.0.8", 19 | "alita": "workspace:*", 20 | "antd-mobile": "^5.10.0" 21 | }, 22 | "devDependencies": { 23 | "@capacitor/cli": "^3.6.0" 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /examples/native/plugin.ts: -------------------------------------------------------------------------------- 1 | import { IApi } from 'umi'; 2 | 3 | export default (api: IApi) => { 4 | api.onDevCompileDone((opts) => { 5 | opts; 6 | // console.log('> onDevCompileDone', opts.isFirstCompile); 7 | }); 8 | api.onBuildComplete((opts) => { 9 | opts; 10 | // console.log('> onBuildComplete', opts.isFirstCompile); 11 | }); 12 | }; 13 | -------------------------------------------------------------------------------- /examples/native/src/assets/demoIcon/home.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/examples/native/src/assets/demoIcon/home.png -------------------------------------------------------------------------------- /examples/native/src/assets/demoIcon/home1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/examples/native/src/assets/demoIcon/home1.png -------------------------------------------------------------------------------- /examples/native/src/assets/demoIcon/list.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/examples/native/src/assets/demoIcon/list.png -------------------------------------------------------------------------------- /examples/native/src/assets/demoIcon/list1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/examples/native/src/assets/demoIcon/list1.png -------------------------------------------------------------------------------- /examples/native/src/assets/demoIcon/setting.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/examples/native/src/assets/demoIcon/setting.png -------------------------------------------------------------------------------- /examples/native/src/assets/demoIcon/setting1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/examples/native/src/assets/demoIcon/setting1.png -------------------------------------------------------------------------------- /examples/native/src/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/examples/native/src/assets/logo.png -------------------------------------------------------------------------------- /examples/native/src/models/index.ts: -------------------------------------------------------------------------------- 1 | import { query } from '@/services/api'; 2 | import type { DvaModel } from 'alita'; 3 | 4 | export interface IndexModelState { 5 | name: string; 6 | } 7 | 8 | const IndexModel: DvaModel = { 9 | namespace: 'index', 10 | 11 | state: { 12 | name: 'Hello Alita', 13 | }, 14 | 15 | effects: { 16 | *query({ payload }, { call, put }) { 17 | const data = yield call(query, payload); 18 | yield put({ 19 | type: 'save', 20 | payload: { name: data.text }, 21 | }); 22 | }, 23 | }, 24 | reducers: { 25 | save(state, action) { 26 | return { 27 | ...state, 28 | ...action.payload, 29 | }; 30 | }, 31 | }, 32 | }; 33 | 34 | export default IndexModel; 35 | -------------------------------------------------------------------------------- /examples/native/src/models/todo.ts: -------------------------------------------------------------------------------- 1 | import { useState } from 'react'; 2 | 3 | export default function () { 4 | const [todos, setTodos] = useState(['foo', 'bar']); 5 | return { 6 | todos, 7 | setTodos, 8 | }; 9 | } 10 | -------------------------------------------------------------------------------- /examples/native/src/pages/foo/index.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | export default () =>

user: Foo

; 4 | -------------------------------------------------------------------------------- /examples/native/src/pages/global.less: -------------------------------------------------------------------------------- 1 | a { 2 | color: green; 3 | } 4 | -------------------------------------------------------------------------------- /examples/native/src/pages/index/index.less: -------------------------------------------------------------------------------- 1 | .title { 2 | font-size: 30px; 3 | } 4 | .adm-button{ 5 | font-size: 30px 6 | } -------------------------------------------------------------------------------- /examples/native/src/pages/index/index.tsx: -------------------------------------------------------------------------------- 1 | import { history } from 'alita'; 2 | import React from 'react'; 3 | import styles from './index.less'; 4 | export default () => ( 5 |
{ 8 | history.push('/users'); 9 | }} 10 | > 11 | Hello Alita 12 |
13 | ); 14 | -------------------------------------------------------------------------------- /examples/native/src/pages/users/index.tsx: -------------------------------------------------------------------------------- 1 | import { Outlet, useLocation } from 'alita'; 2 | import { Button } from 'antd-mobile'; 3 | import React, { useState } from 'react'; 4 | 5 | export default () => { 6 | const [count, setCount] = useState(0); 7 | const location = useLocation(); 8 | return ( 9 |
10 |

users layout

11 |

当前页面状态被设置成自动保存

12 |

当前计数是:{count}

13 | 23 | 24 |
25 | ); 26 | }; 27 | -------------------------------------------------------------------------------- /examples/native/src/services/api.ts: -------------------------------------------------------------------------------- 1 | import { request } from '@@/plugin-request'; 2 | 3 | export async function query(): Promise { 4 | return request('/hello'); 5 | } 6 | -------------------------------------------------------------------------------- /examples/native/typings.d.ts: -------------------------------------------------------------------------------- 1 | declare module '*.css'; 2 | declare module '*.less'; 3 | declare module '*.scss'; 4 | declare module '*.sass'; 5 | declare module '*.svg'; 6 | declare module '*.png'; 7 | declare module '*.jpg'; 8 | declare module '*.jpeg'; 9 | declare module '*.gif'; 10 | declare module '*.bmp'; 11 | declare module '*.tiff'; 12 | declare module '*.json'; 13 | 14 | -------------------------------------------------------------------------------- /examples/patchClientRoutes/config/config.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | appType: 'h5', 3 | mobileLayout: true, 4 | keepalive: [/list/], 5 | mfsu: false, 6 | }; 7 | -------------------------------------------------------------------------------- /examples/patchClientRoutes/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@examples/patch", 3 | "private": true, 4 | "scripts": { 5 | "dev": "alita dev", 6 | "build": "alita build", 7 | "plugin": "alita plugin list", 8 | "start": "npm run dev" 9 | }, 10 | "dependencies": { 11 | "alita": "workspace:*" 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /examples/patchClientRoutes/src/assets/demoIcon/home.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/examples/patchClientRoutes/src/assets/demoIcon/home.png -------------------------------------------------------------------------------- /examples/patchClientRoutes/src/assets/demoIcon/home1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/examples/patchClientRoutes/src/assets/demoIcon/home1.png -------------------------------------------------------------------------------- /examples/patchClientRoutes/src/assets/demoIcon/list.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/examples/patchClientRoutes/src/assets/demoIcon/list.png -------------------------------------------------------------------------------- /examples/patchClientRoutes/src/assets/demoIcon/list1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/examples/patchClientRoutes/src/assets/demoIcon/list1.png -------------------------------------------------------------------------------- /examples/patchClientRoutes/src/assets/demoIcon/setting.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/examples/patchClientRoutes/src/assets/demoIcon/setting.png -------------------------------------------------------------------------------- /examples/patchClientRoutes/src/assets/demoIcon/setting1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/examples/patchClientRoutes/src/assets/demoIcon/setting1.png -------------------------------------------------------------------------------- /examples/patchClientRoutes/src/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/examples/patchClientRoutes/src/assets/logo.png -------------------------------------------------------------------------------- /examples/patchClientRoutes/src/component/DPage/index.tsx: -------------------------------------------------------------------------------- 1 | export default (props) => { 2 | console.log(props); 3 | 4 | return ( 5 |
14 | Hello DPage 这里应该打印出所有的 props,包含 abcProp,但得到 空 {`{}`} 15 | {JSON.stringify(props)} 16 |
17 | ); 18 | }; 19 | -------------------------------------------------------------------------------- /examples/patchClientRoutes/src/pages/index/index.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | export default (props) => { 4 | console.log(props); 5 | return ( 6 |
15 | Hello Alita 16 |
17 | ); 18 | }; 19 | -------------------------------------------------------------------------------- /examples/patchClientRoutes/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "jsx": "react" 4 | }, 5 | "extends": "./src/.umi/tsconfig" 6 | } 7 | -------------------------------------------------------------------------------- /examples/patchClientRoutes/typings.d.ts: -------------------------------------------------------------------------------- 1 | declare module '*.css'; 2 | declare module '*.less'; 3 | declare module '*.scss'; 4 | declare module '*.sass'; 5 | declare module '*.svg'; 6 | declare module '*.png'; 7 | declare module '*.jpg'; 8 | declare module '*.jpeg'; 9 | declare module '*.gif'; 10 | declare module '*.bmp'; 11 | declare module '*.tiff'; 12 | declare module '*.json'; 13 | declare module 'rc-animate'; 14 | declare module 'omit.js'; 15 | declare module 'react-copy-to-clipboard'; 16 | declare module 'react-fittext'; 17 | declare module '@antv/data-set'; 18 | declare module 'nzh/cn'; 19 | -------------------------------------------------------------------------------- /examples/pro/config/defaultSettings.ts: -------------------------------------------------------------------------------- 1 | import { Settings as LayoutSettings } from '@ant-design/pro-components'; 2 | 3 | /** 4 | * @name 5 | */ 6 | const Settings: LayoutSettings & { 7 | pwa?: boolean; 8 | logo?: string; 9 | } = { 10 | navTheme: 'light', 11 | // 拂晓蓝 12 | colorPrimary: '#1890ff', 13 | layout: 'mix', 14 | contentWidth: 'Fluid', 15 | fixedHeader: false, 16 | fixSiderbar: true, 17 | colorWeak: false, 18 | title: 'Ant Design Pro', 19 | pwa: false, 20 | logo: 'https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg', 21 | iconfontUrl: '', 22 | }; 23 | 24 | export default Settings; 25 | -------------------------------------------------------------------------------- /examples/pro/mock/route.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | '/api/auth_routes': { 3 | '/form/advanced-form': { authority: ['admin', 'user'] }, 4 | }, 5 | }; 6 | -------------------------------------------------------------------------------- /examples/pro/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@examples/pro", 3 | "private": true, 4 | "description": "An out-of-box UI solution for enterprise applications", 5 | "scripts": { 6 | "openapi": "max openapi", 7 | "start": "npm run dev" 8 | }, 9 | "dependencies": { 10 | "@ant-design/icons": "^4.7.0", 11 | "@ant-design/pro-components": "^2.0.0", 12 | "antd": "^4.20.0", 13 | "classnames": "^2.3.0", 14 | "lodash": "^4.17.0", 15 | "moment": "^2.29.0", 16 | "rc-menu": "^9.1.0", 17 | "rc-util": "^5.16.0", 18 | "@umijs/max": "^4.0.0-rc.22", 19 | "@umijs/openapi": "^1.3.0", 20 | "@alita/plugins": "workspace:*" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /examples/pro/plugin.ts: -------------------------------------------------------------------------------- 1 | import { IApi } from '@umijs/max'; 2 | 3 | export default (api: IApi) => { 4 | const { REACT_APP_ENV } = process.env; 5 | 6 | const configDefaults: Record = { 7 | define: { 8 | ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION: '', 9 | REACT_APP_ENV: REACT_APP_ENV || false, 10 | }, 11 | ...api.userConfig, 12 | }; 13 | 14 | api.modifyConfig((memo: any) => { 15 | Object.keys(configDefaults).forEach((key) => { 16 | memo[key] = configDefaults[key]; 17 | }); 18 | return memo; 19 | }); 20 | }; 21 | -------------------------------------------------------------------------------- /examples/pro/src/access.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @see https://umijs.org/zh-CN/plugins/plugin-access 3 | * */ 4 | export default function access( 5 | initialState: { currentUser?: API.CurrentUser } | undefined, 6 | ) { 7 | const { currentUser } = initialState ?? {}; 8 | return { 9 | canAdmin: currentUser && currentUser.access === 'admin', 10 | }; 11 | } 12 | -------------------------------------------------------------------------------- /examples/pro/src/components/HeaderDropdown/index.less: -------------------------------------------------------------------------------- 1 | @import (reference) '~antd/es/style/themes/index'; 2 | 3 | .container > * { 4 | background-color: @popover-bg; 5 | border-radius: 4px; 6 | box-shadow: @shadow-1-down; 7 | } 8 | 9 | @media screen and (max-width: @screen-xs) { 10 | .container { 11 | width: 100% !important; 12 | } 13 | .container > * { 14 | border-radius: 0 !important; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /examples/pro/src/components/HeaderSearch/index.less: -------------------------------------------------------------------------------- 1 | @import (reference) '~antd/es/style/themes/index'; 2 | 3 | .headerSearch { 4 | display: inline-flex; 5 | align-items: center; 6 | .input { 7 | width: 0; 8 | min-width: 0; 9 | overflow: hidden; 10 | background: transparent; 11 | border-radius: 0; 12 | transition: width 0.3s, margin-left 0.3s; 13 | :global(.ant-select-selection) { 14 | background: transparent; 15 | } 16 | input { 17 | box-shadow: none !important; 18 | } 19 | 20 | &.show { 21 | width: 210px; 22 | margin-left: 8px; 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /examples/pro/src/components/NoticeIcon/index.less: -------------------------------------------------------------------------------- 1 | @import (reference) '~antd/es/style/themes/index'; 2 | 3 | .popover { 4 | position: relative; 5 | width: 336px; 6 | } 7 | 8 | .noticeButton { 9 | display: inline-block; 10 | cursor: pointer; 11 | transition: all 0.3s; 12 | } 13 | .icon { 14 | padding: 4px; 15 | vertical-align: middle; 16 | } 17 | 18 | .badge { 19 | font-size: 16px; 20 | } 21 | 22 | .tabs { 23 | :global { 24 | .ant-tabs-nav-list { 25 | margin: auto; 26 | } 27 | 28 | .ant-tabs-nav-scroll { 29 | text-align: center; 30 | } 31 | .ant-tabs-nav { 32 | margin-bottom: 0; 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /examples/pro/src/locales/bn-BD/component.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | 'component.tagSelect.expand': 'বিস্তৃত', 3 | 'component.tagSelect.collapse': 'সঙ্কুচিত', 4 | 'component.tagSelect.all': 'সব', 5 | }; 6 | -------------------------------------------------------------------------------- /examples/pro/src/locales/bn-BD/pwa.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | 'app.pwa.offline': 'আপনি এখন অফলাইন', 3 | 'app.pwa.serviceworker.updated': 'নতুন সামগ্রী উপলব্ধ', 4 | 'app.pwa.serviceworker.updated.hint': 5 | 'বর্তমান পৃষ্ঠাটি পুনরায় লোড করতে দয়া করে "রিফ্রেশ" বোতাম টিপুন', 6 | 'app.pwa.serviceworker.updated.ok': 'রিফ্রেশ', 7 | }; 8 | -------------------------------------------------------------------------------- /examples/pro/src/locales/en-US/component.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | 'component.tagSelect.expand': 'Expand', 3 | 'component.tagSelect.collapse': 'Collapse', 4 | 'component.tagSelect.all': 'All', 5 | }; 6 | -------------------------------------------------------------------------------- /examples/pro/src/locales/en-US/pwa.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | 'app.pwa.offline': 'You are offline now', 3 | 'app.pwa.serviceworker.updated': 'New content is available', 4 | 'app.pwa.serviceworker.updated.hint': 5 | 'Please press the "Refresh" button to reload current page', 6 | 'app.pwa.serviceworker.updated.ok': 'Refresh', 7 | }; 8 | -------------------------------------------------------------------------------- /examples/pro/src/locales/fa-IR/component.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | 'component.tagSelect.expand': 'باز', 3 | 'component.tagSelect.collapse': 'بسته ', 4 | 'component.tagSelect.all': 'همه', 5 | }; 6 | -------------------------------------------------------------------------------- /examples/pro/src/locales/fa-IR/pwa.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | 'app.pwa.offline': 'شما اکنون آفلاین هستید', 3 | 'app.pwa.serviceworker.updated': 'مطالب جدید در دسترس است', 4 | 'app.pwa.serviceworker.updated.hint': 5 | 'لطفاً برای بارگیری مجدد صفحه فعلی ، دکمه "تازه سازی" را فشار دهید', 6 | 'app.pwa.serviceworker.updated.ok': 'تازه سازی', 7 | }; 8 | -------------------------------------------------------------------------------- /examples/pro/src/locales/id-ID/component.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | 'component.tagSelect.expand': 'Perluas', 3 | 'component.tagSelect.collapse': 'Lipat', 4 | 'component.tagSelect.all': 'Semua', 5 | }; 6 | -------------------------------------------------------------------------------- /examples/pro/src/locales/id-ID/pwa.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | 'app.pwa.offline': 'Koneksi anda terputus', 3 | 'app.pwa.serviceworker.updated': 'Konten baru sudah tersedia', 4 | 'app.pwa.serviceworker.updated.hint': 5 | 'Silahkan klik tombol "Refresh" untuk memuat ulang halaman ini', 6 | 'app.pwa.serviceworker.updated.ok': 'Memuat ulang', 7 | }; 8 | -------------------------------------------------------------------------------- /examples/pro/src/locales/ja-JP.ts: -------------------------------------------------------------------------------- 1 | import component from './ja-JP/component'; 2 | import globalHeader from './ja-JP/globalHeader'; 3 | import menu from './ja-JP/menu'; 4 | import pages from './ja-JP/pages'; 5 | import pwa from './ja-JP/pwa'; 6 | import settingDrawer from './ja-JP/settingDrawer'; 7 | import settings from './ja-JP/settings'; 8 | 9 | export default { 10 | 'navBar.lang': '言語', 11 | 'layout.user.link.help': 'ヘルプ', 12 | 'layout.user.link.privacy': 'プライバシー', 13 | 'layout.user.link.terms': '利用規約', 14 | 'app.preview.down.block': 15 | 'このページをローカルプロジェクトにダウンロードしてください', 16 | 'app.welcome.link.fetch-blocks': '', 17 | 'app.welcome.link.block-list': '', 18 | ...globalHeader, 19 | ...menu, 20 | ...settingDrawer, 21 | ...settings, 22 | ...pwa, 23 | ...component, 24 | ...pages, 25 | }; 26 | -------------------------------------------------------------------------------- /examples/pro/src/locales/ja-JP/component.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | 'component.tagSelect.expand': '展開', 3 | 'component.tagSelect.collapse': '折りたたむ', 4 | 'component.tagSelect.all': 'すべて', 5 | }; 6 | -------------------------------------------------------------------------------- /examples/pro/src/locales/ja-JP/globalHeader.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | 'component.globalHeader.search': '検索', 3 | 'component.globalHeader.search.example1': '検索例1', 4 | 'component.globalHeader.search.example2': '検索例2', 5 | 'component.globalHeader.search.example3': '検索例3', 6 | 'component.globalHeader.help': 'ヘルプ', 7 | 'component.globalHeader.notification': '通知', 8 | 'component.globalHeader.notification.empty': 'すべての通知を表示しました。', 9 | 'component.globalHeader.message': 'メッセージ', 10 | 'component.globalHeader.message.empty': 'すべてのメッセージを表示しました。', 11 | 'component.globalHeader.event': 'イベント', 12 | 'component.globalHeader.event.empty': 'すべてのイベントを表示しました。', 13 | 'component.noticeIcon.clear': 'クリア', 14 | 'component.noticeIcon.cleared': 'クリア済み', 15 | 'component.noticeIcon.empty': '通知なし', 16 | 'component.noticeIcon.view-more': 'もっと見る', 17 | }; 18 | -------------------------------------------------------------------------------- /examples/pro/src/locales/ja-JP/pwa.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | 'app.pwa.offline': 'あなたは今オフラインです', 3 | 'app.pwa.serviceworker.updated': '新しいコンテンツが利用可能です', 4 | 'app.pwa.serviceworker.updated.hint': 5 | '現在のページをリロードするには、「更新」ボタンを押してください', 6 | 'app.pwa.serviceworker.updated.ok': 'リフレッシュ', 7 | }; 8 | -------------------------------------------------------------------------------- /examples/pro/src/locales/pt-BR.ts: -------------------------------------------------------------------------------- 1 | import component from './pt-BR/component'; 2 | import globalHeader from './pt-BR/globalHeader'; 3 | import menu from './pt-BR/menu'; 4 | import pages from './pt-BR/pages'; 5 | import pwa from './pt-BR/pwa'; 6 | import settingDrawer from './pt-BR/settingDrawer'; 7 | import settings from './pt-BR/settings'; 8 | 9 | export default { 10 | 'navBar.lang': 'Idiomas', 11 | 'layout.user.link.help': 'ajuda', 12 | 'layout.user.link.privacy': 'política de privacidade', 13 | 'layout.user.link.terms': 'termos de serviços', 14 | 'app.preview.down.block': 'Download this page to your local project', 15 | ...globalHeader, 16 | ...menu, 17 | ...settingDrawer, 18 | ...settings, 19 | ...pwa, 20 | ...component, 21 | ...pages, 22 | }; 23 | -------------------------------------------------------------------------------- /examples/pro/src/locales/pt-BR/component.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | 'component.tagSelect.expand': 'Expandir', 3 | 'component.tagSelect.collapse': 'Diminuir', 4 | 'component.tagSelect.all': 'Todas', 5 | }; 6 | -------------------------------------------------------------------------------- /examples/pro/src/locales/pt-BR/pwa.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | 'app.pwa.offline': 'Você está offline agora', 3 | 'app.pwa.serviceworker.updated': 'Novo conteúdo está disponível', 4 | 'app.pwa.serviceworker.updated.hint': 5 | 'Por favor, pressione o botão "Atualizar" para recarregar a página atual', 6 | 'app.pwa.serviceworker.updated.ok': 'Atualizar', 7 | }; 8 | -------------------------------------------------------------------------------- /examples/pro/src/locales/zh-CN.ts: -------------------------------------------------------------------------------- 1 | import component from './zh-CN/component'; 2 | import globalHeader from './zh-CN/globalHeader'; 3 | import menu from './zh-CN/menu'; 4 | import pages from './zh-CN/pages'; 5 | import pwa from './zh-CN/pwa'; 6 | import settingDrawer from './zh-CN/settingDrawer'; 7 | import settings from './zh-CN/settings'; 8 | 9 | export default { 10 | 'navBar.lang': '语言', 11 | 'layout.user.link.help': '帮助', 12 | 'layout.user.link.privacy': '隐私', 13 | 'layout.user.link.terms': '条款', 14 | 'app.copyright.produced': '蚂蚁集团体验技术部出品', 15 | 'app.preview.down.block': '下载此页面到本地项目', 16 | 'app.welcome.link.fetch-blocks': '获取全部区块', 17 | 'app.welcome.link.block-list': '基于 block 开发,快速构建标准页面', 18 | ...pages, 19 | ...globalHeader, 20 | ...menu, 21 | ...settingDrawer, 22 | ...settings, 23 | ...pwa, 24 | ...component, 25 | }; 26 | -------------------------------------------------------------------------------- /examples/pro/src/locales/zh-CN/component.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | 'component.tagSelect.expand': '展开', 3 | 'component.tagSelect.collapse': '收起', 4 | 'component.tagSelect.all': '全部', 5 | }; 6 | -------------------------------------------------------------------------------- /examples/pro/src/locales/zh-CN/globalHeader.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | 'component.globalHeader.search': '站内搜索', 3 | 'component.globalHeader.search.example1': '搜索提示一', 4 | 'component.globalHeader.search.example2': '搜索提示二', 5 | 'component.globalHeader.search.example3': '搜索提示三', 6 | 'component.globalHeader.help': '使用文档', 7 | 'component.globalHeader.notification': '通知', 8 | 'component.globalHeader.notification.empty': '你已查看所有通知', 9 | 'component.globalHeader.message': '消息', 10 | 'component.globalHeader.message.empty': '您已读完所有消息', 11 | 'component.globalHeader.event': '待办', 12 | 'component.globalHeader.event.empty': '你已完成所有待办', 13 | 'component.noticeIcon.clear': '清空', 14 | 'component.noticeIcon.cleared': '清空了', 15 | 'component.noticeIcon.empty': '暂无数据', 16 | 'component.noticeIcon.view-more': '查看更多', 17 | }; 18 | -------------------------------------------------------------------------------- /examples/pro/src/locales/zh-CN/pwa.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | 'app.pwa.offline': '当前处于离线状态', 3 | 'app.pwa.serviceworker.updated': '有新内容', 4 | 'app.pwa.serviceworker.updated.hint': '请点击“刷新”按钮或者手动刷新页面', 5 | 'app.pwa.serviceworker.updated.ok': '刷新', 6 | }; 7 | -------------------------------------------------------------------------------- /examples/pro/src/locales/zh-TW.ts: -------------------------------------------------------------------------------- 1 | import component from './zh-TW/component'; 2 | import globalHeader from './zh-TW/globalHeader'; 3 | import menu from './zh-TW/menu'; 4 | import pwa from './zh-TW/pwa'; 5 | import settingDrawer from './zh-TW/settingDrawer'; 6 | import settings from './zh-TW/settings'; 7 | 8 | export default { 9 | 'navBar.lang': '語言', 10 | 'layout.user.link.help': '幫助', 11 | 'layout.user.link.privacy': '隱私', 12 | 'layout.user.link.terms': '條款', 13 | 'app.preview.down.block': '下載此頁面到本地項目', 14 | ...globalHeader, 15 | ...menu, 16 | ...settingDrawer, 17 | ...settings, 18 | ...pwa, 19 | ...component, 20 | }; 21 | -------------------------------------------------------------------------------- /examples/pro/src/locales/zh-TW/component.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | 'component.tagSelect.expand': '展開', 3 | 'component.tagSelect.collapse': '收起', 4 | 'component.tagSelect.all': '全部', 5 | }; 6 | -------------------------------------------------------------------------------- /examples/pro/src/locales/zh-TW/globalHeader.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | 'component.globalHeader.search': '站內搜索', 3 | 'component.globalHeader.search.example1': '搜索提示壹', 4 | 'component.globalHeader.search.example2': '搜索提示二', 5 | 'component.globalHeader.search.example3': '搜索提示三', 6 | 'component.globalHeader.help': '使用手冊', 7 | 'component.globalHeader.notification': '通知', 8 | 'component.globalHeader.notification.empty': '妳已查看所有通知', 9 | 'component.globalHeader.message': '消息', 10 | 'component.globalHeader.message.empty': '您已讀完所有消息', 11 | 'component.globalHeader.event': '待辦', 12 | 'component.globalHeader.event.empty': '妳已完成所有待辦', 13 | 'component.noticeIcon.clear': '清空', 14 | 'component.noticeIcon.cleared': '清空了', 15 | 'component.noticeIcon.empty': '暫無資料', 16 | 'component.noticeIcon.view-more': '查看更多', 17 | }; 18 | -------------------------------------------------------------------------------- /examples/pro/src/locales/zh-TW/pwa.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | 'app.pwa.offline': '當前處於離線狀態', 3 | 'app.pwa.serviceworker.updated': '有新內容', 4 | 'app.pwa.serviceworker.updated.hint': '請點擊“刷新”按鈕或者手動刷新頁面', 5 | 'app.pwa.serviceworker.updated.ok': '刷新', 6 | }; 7 | -------------------------------------------------------------------------------- /examples/pro/src/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Ant Design Pro", 3 | "short_name": "Ant Design Pro", 4 | "display": "standalone", 5 | "start_url": "./?utm_source=homescreen", 6 | "theme_color": "#002140", 7 | "background_color": "#001529", 8 | "icons": [ 9 | { 10 | "src": "icons/icon-192x192.png", 11 | "sizes": "192x192" 12 | }, 13 | { 14 | "src": "icons/icon-128x128.png", 15 | "sizes": "128x128" 16 | }, 17 | { 18 | "src": "icons/icon-512x512.png", 19 | "sizes": "512x512" 20 | } 21 | ] 22 | } 23 | -------------------------------------------------------------------------------- /examples/pro/src/pages/404.tsx: -------------------------------------------------------------------------------- 1 | import { history } from '@umijs/max'; 2 | import { Button, Result } from 'antd'; 3 | import React from 'react'; 4 | 5 | const NoFoundPage: React.FC = () => ( 6 | history.push('/')}> 12 | Back Home 13 | 14 | } 15 | /> 16 | ); 17 | 18 | export default NoFoundPage; 19 | -------------------------------------------------------------------------------- /examples/pro/src/services/ant-design-pro/index.ts: -------------------------------------------------------------------------------- 1 | // @ts-ignore 2 | /* eslint-disable */ 3 | // API 更新时间: 4 | // API 唯一标识: 5 | import * as api from './api'; 6 | import * as login from './login'; 7 | export default { 8 | api, 9 | login, 10 | }; 11 | -------------------------------------------------------------------------------- /examples/pro/src/services/ant-design-pro/login.ts: -------------------------------------------------------------------------------- 1 | // @ts-ignore 2 | /* eslint-disable */ 3 | import { request } from '@umijs/max'; 4 | 5 | /** 发送验证码 POST /api/login/captcha */ 6 | export async function getFakeCaptcha( 7 | params: { 8 | // query 9 | /** 手机号 */ 10 | phone?: string; 11 | }, 12 | options?: { [key: string]: any }, 13 | ) { 14 | return request('/api/login/captcha', { 15 | method: 'GET', 16 | params: { 17 | ...params, 18 | }, 19 | ...(options || {}), 20 | }); 21 | } 22 | -------------------------------------------------------------------------------- /examples/pro/src/services/swagger/index.ts: -------------------------------------------------------------------------------- 1 | // @ts-ignore 2 | /* eslint-disable */ 3 | // API 更新时间: 4 | // API 唯一标识: 5 | import * as pet from './pet'; 6 | import * as store from './store'; 7 | import * as user from './user'; 8 | export default { 9 | pet, 10 | store, 11 | user, 12 | }; 13 | -------------------------------------------------------------------------------- /examples/pro/src/typings.d.ts: -------------------------------------------------------------------------------- 1 | declare module 'slash2'; 2 | declare module '*.css'; 3 | declare module '*.less'; 4 | declare module '*.scss'; 5 | declare module '*.sass'; 6 | declare module '*.svg'; 7 | declare module '*.png'; 8 | declare module '*.jpg'; 9 | declare module '*.jpeg'; 10 | declare module '*.gif'; 11 | declare module '*.bmp'; 12 | declare module '*.tiff'; 13 | declare module 'omit.js'; 14 | declare module 'numeral'; 15 | declare module '@antv/data-set'; 16 | declare module 'mockjs'; 17 | declare module 'react-fittext'; 18 | declare module 'bizcharts-plugin-slider'; 19 | 20 | // preview.pro.ant.design only do not use in your production ; 21 | // preview.pro.ant.design Dedicated environment variable, please do not use it in your project. 22 | declare let ANT_DESIGN_PRO_ONLY_DO_NOT_USE_IN_YOUR_PRODUCTION: 'site' | undefined; 23 | 24 | declare const REACT_APP_ENV: 'test' | 'dev' | 'pre' | false; 25 | -------------------------------------------------------------------------------- /examples/rerender/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@examples/rerender", 3 | "private": true, 4 | "scripts": { 5 | "dev": "alita dev", 6 | "build": "alita build", 7 | "plugin": "alita plugin list", 8 | "start": "npm run dev" 9 | }, 10 | "dependencies": { 11 | "alita": "workspace:*" 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /examples/rerender/src/pages/index/index.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | const Demo = ({ data }: any) => ( 4 |
5 |
{Math.random()}
6 | {JSON.stringify(data)} 7 |
8 | ); 9 | const Count = () => { 10 | const [count, setCount] = React.useState(0); 11 | return ( 12 |
13 | {count} 14 |
{Math.random()}
15 | 22 |
23 | ); 24 | }; 25 | const Provider = (props: any) =>
{props.children}
; 26 | export default () => { 27 | const [data, setData] = React.useState({ name: 'foo' }); 28 | return ( 29 |
30 | 31 | 32 | 33 | 34 |
35 | ); 36 | }; 37 | -------------------------------------------------------------------------------- /examples/routes/.env: -------------------------------------------------------------------------------- 1 | UMI_ENV=cloud 2 | -------------------------------------------------------------------------------- /examples/routes/.gitignore: -------------------------------------------------------------------------------- 1 | /.env.local 2 | /.umirc.local.ts 3 | /.umirc.local.js 4 | /config/config.local.ts 5 | /config/config.local.js 6 | /src/.umi 7 | /.umi 8 | -------------------------------------------------------------------------------- /examples/routes/config/config.cloud.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | appType: 'h5', 3 | aconsole: { 4 | console: {}, 5 | inspx: {}, 6 | }, 7 | mobileLayout: true, 8 | polyfill: false, 9 | // mainPath:'users', 10 | mfsu: {}, 11 | hash: false, 12 | }; 13 | -------------------------------------------------------------------------------- /examples/routes/config/config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'alita'; 2 | 3 | export default defineConfig({ 4 | appType: 'h5', 5 | // 这个值在 appts 中被 getKeepAlive 修改 6 | keepalive: [], 7 | mobileLayout: true, 8 | legacyBuild: false, 9 | // mainPath:'users', 10 | mfsu: {}, 11 | hash: false, 12 | // 可以通过配置里面指定 isKeepalive 来实现状态保持 13 | routes: [ 14 | { 15 | path: '/', 16 | isKeepalive: true, 17 | component: './index', 18 | }, 19 | { 20 | path: '/users', 21 | isKeepalive: true, 22 | component: './users', 23 | }, 24 | ], 25 | }); 26 | -------------------------------------------------------------------------------- /examples/routes/mock/app.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | '/api/hello': { 3 | text: 'Alita', 4 | }, 5 | }; 6 | -------------------------------------------------------------------------------- /examples/routes/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@examples/routes", 3 | "private": true, 4 | "scripts": { 5 | "dev": "alita dev", 6 | "build": "alita build", 7 | "plugin": "alita plugin list", 8 | "start": "npm run dev" 9 | }, 10 | "dependencies": { 11 | "@alita/flow": "workspace:*", 12 | "ahooks": "^3.0.8", 13 | "alita": "workspace:*", 14 | "antd-mobile": "^5.10.0" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /examples/routes/plugin.ts: -------------------------------------------------------------------------------- 1 | import { IApi } from 'umi'; 2 | 3 | export default (api: IApi) => { 4 | api.onDevCompileDone((opts) => { 5 | opts; 6 | // console.log('> onDevCompileDone', opts.isFirstCompile); 7 | }); 8 | api.onBuildComplete((opts) => { 9 | opts; 10 | // console.log('> onBuildComplete', opts.isFirstCompile); 11 | }); 12 | }; 13 | -------------------------------------------------------------------------------- /examples/routes/src/assets/demoIcon/home.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/examples/routes/src/assets/demoIcon/home.png -------------------------------------------------------------------------------- /examples/routes/src/assets/demoIcon/home1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/examples/routes/src/assets/demoIcon/home1.png -------------------------------------------------------------------------------- /examples/routes/src/assets/demoIcon/list.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/examples/routes/src/assets/demoIcon/list.png -------------------------------------------------------------------------------- /examples/routes/src/assets/demoIcon/list1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/examples/routes/src/assets/demoIcon/list1.png -------------------------------------------------------------------------------- /examples/routes/src/assets/demoIcon/setting.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/examples/routes/src/assets/demoIcon/setting.png -------------------------------------------------------------------------------- /examples/routes/src/assets/demoIcon/setting1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/examples/routes/src/assets/demoIcon/setting1.png -------------------------------------------------------------------------------- /examples/routes/src/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/examples/routes/src/assets/logo.png -------------------------------------------------------------------------------- /examples/routes/src/models/index.ts: -------------------------------------------------------------------------------- 1 | import { query } from '@/services/api'; 2 | import type { DvaModel } from 'alita'; 3 | 4 | export interface IndexModelState { 5 | name: string; 6 | } 7 | 8 | const IndexModel: DvaModel = { 9 | namespace: 'index', 10 | 11 | state: { 12 | name: 'Hello Alita', 13 | }, 14 | 15 | effects: { 16 | *query({ payload }, { call, put }) { 17 | const data = yield call(query, payload); 18 | yield put({ 19 | type: 'save', 20 | payload: { name: data.text }, 21 | }); 22 | }, 23 | }, 24 | reducers: { 25 | save(state, action) { 26 | return { 27 | ...state, 28 | ...action.payload, 29 | }; 30 | }, 31 | }, 32 | }; 33 | 34 | export default IndexModel; 35 | -------------------------------------------------------------------------------- /examples/routes/src/models/todo.ts: -------------------------------------------------------------------------------- 1 | import { useState } from 'react'; 2 | 3 | export default function () { 4 | const [todos, setTodos] = useState(['foo', 'bar']); 5 | return { 6 | todos, 7 | setTodos, 8 | }; 9 | } 10 | -------------------------------------------------------------------------------- /examples/routes/src/pages/foo/$index.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | export default () =>

user: Foo

; 4 | -------------------------------------------------------------------------------- /examples/routes/src/pages/global.less: -------------------------------------------------------------------------------- 1 | a { 2 | color: green; 3 | } 4 | -------------------------------------------------------------------------------- /examples/routes/src/pages/index/index.less: -------------------------------------------------------------------------------- 1 | .title { 2 | font-size: 30px; 3 | } 4 | .adm-button{ 5 | font-size: 30px 6 | } -------------------------------------------------------------------------------- /examples/routes/src/pages/index/index.tsx: -------------------------------------------------------------------------------- 1 | import { Button } from 'antd-mobile'; 2 | import React, { useState } from 'react'; 3 | import styles from './index.less'; 4 | export default () => { 5 | const [count, setCount] = useState(0); 6 | return ( 7 |
8 | Hello Alita 9 | 19 |
20 | ); 21 | }; 22 | -------------------------------------------------------------------------------- /examples/routes/src/services/api.ts: -------------------------------------------------------------------------------- 1 | import { request } from '@@/plugin-request'; 2 | 3 | export async function query(): Promise { 4 | return request('/hello'); 5 | } 6 | -------------------------------------------------------------------------------- /examples/routes/typings.d.ts: -------------------------------------------------------------------------------- 1 | declare module '*.css'; 2 | declare module '*.less'; 3 | declare module '*.scss'; 4 | declare module '*.sass'; 5 | declare module '*.svg'; 6 | declare module '*.png'; 7 | declare module '*.jpg'; 8 | declare module '*.jpeg'; 9 | declare module '*.gif'; 10 | declare module '*.bmp'; 11 | declare module '*.tiff'; 12 | declare module '*.json'; 13 | 14 | -------------------------------------------------------------------------------- /examples/tabs-custom/.env: -------------------------------------------------------------------------------- 1 | PORT=8989 2 | -------------------------------------------------------------------------------- /examples/tabs-custom/.gitignore: -------------------------------------------------------------------------------- 1 | /.env.local 2 | /.umirc.local.ts 3 | /.umirc.local.js 4 | /config/config.local.ts 5 | /config/config.local.js 6 | /src/.umi 7 | /.umi 8 | -------------------------------------------------------------------------------- /examples/tabs-custom/.umirc.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | appType: 'pc', 3 | keepalive: [/./], 4 | mfsu: {}, 5 | antd: {}, 6 | hash: false, 7 | tabsLayout: { 8 | hasCustomTabs: true, 9 | hasDropdown: true, 10 | hasFixedHeader: true, 11 | }, 12 | locale: { 13 | // 默认使用 src/locales/zh-CN.ts 作为多语言文件 14 | default: 'zh-CN', 15 | baseSeparator: '-', 16 | }, 17 | routes: [ 18 | { 19 | path: '/users', 20 | name: 'users', 21 | icon: 'smile', 22 | component: './users', 23 | }, 24 | { 25 | path: '/foo/:index', 26 | name: 'foo', 27 | icon: 'smile', 28 | component: './foo', 29 | }, 30 | { 31 | path: '/', 32 | name: 'home', 33 | icon: 'smile', 34 | component: './index', 35 | }, 36 | ], 37 | }; 38 | -------------------------------------------------------------------------------- /examples/tabs-custom/e2e/tabs-custom.test.ts: -------------------------------------------------------------------------------- 1 | import { expect, test } from '@playwright/test'; 2 | 3 | test.beforeEach(async ({ page }) => { 4 | await page.goto('http://localhost:8989/'); 5 | }); 6 | 7 | test.describe('basic', () => { 8 | test('render', async ({ page }) => { 9 | await expect( 10 | page.getByText('Hello Alita, Click Me Close This Tab!'), 11 | ).toBeVisible(); 12 | }); 13 | }); 14 | -------------------------------------------------------------------------------- /examples/tabs-custom/mock/app.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | '/api/hello': { 3 | text: 'Alita', 4 | }, 5 | }; 6 | -------------------------------------------------------------------------------- /examples/tabs-custom/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@examples/tabs-custom", 3 | "private": true, 4 | "scripts": { 5 | "dev": "alita dev", 6 | "build": "ANALYZE=1 alita build", 7 | "plugin": "alita plugin list", 8 | "test:e2e": "start-test dev :8989/__umi/api/status test:pw", 9 | "test:pw": "playwright test", 10 | "start": "npm run dev" 11 | }, 12 | "dependencies": { 13 | "@alita/flow": "workspace:*", 14 | "@ant-design/icons": "^4.7.0", 15 | "alita": "workspace:*", 16 | "antd": "^4.24.8" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /examples/tabs-custom/plugin.ts: -------------------------------------------------------------------------------- 1 | import { IApi } from 'umi'; 2 | 3 | export default (api: IApi) => { 4 | api.onDevCompileDone((opts) => { 5 | opts; 6 | // console.log('> onDevCompileDone', opts.isFirstCompile); 7 | }); 8 | api.onBuildComplete((opts) => { 9 | opts; 10 | // console.log('> onBuildComplete', opts.isFirstCompile); 11 | }); 12 | }; 13 | -------------------------------------------------------------------------------- /examples/tabs-custom/src/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/examples/tabs-custom/src/assets/logo.png -------------------------------------------------------------------------------- /examples/tabs-custom/src/global.less: -------------------------------------------------------------------------------- 1 | .runtime-keep-alive-layout > .ant-tabs-card .ant-tabs-tab-active { 2 | background: #fff; 3 | border-color: #fff; 4 | } 5 | -------------------------------------------------------------------------------- /examples/tabs-custom/src/locales/en-US.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | welcome: 'welcome to umi', 3 | 'tabs.close.left': 'Close Left', 4 | 'tabs.close.right': 'Close Right', 5 | 'tabs.close.others': 'Close Others', 6 | 'tabs.refresh': 'Refresh', 7 | 'tabs.warning': 'please remain at least one tab', 8 | }; 9 | -------------------------------------------------------------------------------- /examples/tabs-custom/src/locales/zh-CN.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | welcome: '欢迎光临 Umi 的世界!', 3 | 'tabs.close.left': '关闭左侧', 4 | 'tabs.close.right': '关闭右侧', 5 | 'tabs.close.others': '关闭其他', 6 | 'tabs.refresh': '刷新', 7 | 'tabs.warning': '至少要保留一个窗口', 8 | }; 9 | -------------------------------------------------------------------------------- /examples/tabs-custom/src/pages/index.less: -------------------------------------------------------------------------------- 1 | .title { 2 | font-size: 30px; 3 | } 4 | .adm-button{ 5 | font-size: 30px 6 | } -------------------------------------------------------------------------------- /examples/tabs-custom/src/pages/index.tsx: -------------------------------------------------------------------------------- 1 | import { closeTab } from 'alita'; 2 | import React from 'react'; 3 | import styles from './index.less'; 4 | export default () => ( 5 |
{ 8 | closeTab('/'); 9 | }} 10 | > 11 | Hello Alita, Click Me Close This Tab! 12 |
13 | ); 14 | -------------------------------------------------------------------------------- /examples/tabs-custom/src/services/api.ts: -------------------------------------------------------------------------------- 1 | import { request } from '@@/plugin-request'; 2 | 3 | export async function query(): Promise { 4 | return request('/hello'); 5 | } 6 | -------------------------------------------------------------------------------- /examples/tabs-custom/typings.d.ts: -------------------------------------------------------------------------------- 1 | declare module '*.css'; 2 | declare module '*.less'; 3 | declare module '*.scss'; 4 | declare module '*.sass'; 5 | declare module '*.svg'; 6 | declare module '*.png'; 7 | declare module '*.jpg'; 8 | declare module '*.jpeg'; 9 | declare module '*.gif'; 10 | declare module '*.bmp'; 11 | declare module '*.tiff'; 12 | declare module '*.json'; 13 | 14 | -------------------------------------------------------------------------------- /examples/tabs-routes/.env: -------------------------------------------------------------------------------- 1 | PORT=8988 2 | -------------------------------------------------------------------------------- /examples/tabs-routes/.gitignore: -------------------------------------------------------------------------------- 1 | /.env.local 2 | /.umirc.local.ts 3 | /.umirc.local.js 4 | /config/config.local.ts 5 | /config/config.local.js 6 | /src/.umi 7 | /.umi 8 | -------------------------------------------------------------------------------- /examples/tabs-routes/.umirc.ts: -------------------------------------------------------------------------------- 1 | import routes from './src/routes'; 2 | 3 | export default { 4 | appType: 'pc', 5 | keepalive: [], 6 | aconsole: { 7 | console: {}, 8 | inspx: {}, 9 | }, 10 | mfsu: {}, 11 | antd: {}, 12 | hash: false, 13 | tabsLayout: {}, 14 | routes, 15 | }; 16 | -------------------------------------------------------------------------------- /examples/tabs-routes/e2e/tabs-routes.test.ts: -------------------------------------------------------------------------------- 1 | import { expect, test } from '@playwright/test'; 2 | 3 | test.beforeEach(async ({ page }) => { 4 | await page.goto('http://localhost:8988/'); 5 | }); 6 | 7 | test.describe('basic', () => { 8 | test('render', async ({ page }) => { 9 | await expect(page.getByText('Hello Alita')).toBeVisible(); 10 | }); 11 | }); 12 | -------------------------------------------------------------------------------- /examples/tabs-routes/mock/app.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | '/api/hello': { 3 | text: 'Alita', 4 | }, 5 | }; 6 | -------------------------------------------------------------------------------- /examples/tabs-routes/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@examples/tabs-routes", 3 | "private": true, 4 | "scripts": { 5 | "dev": "alita dev", 6 | "build": "ANALYZE=1 alita build", 7 | "plugin": "alita plugin list", 8 | "test:e2e": "start-test dev :8988/__umi/api/status test:pw", 9 | "test:pw": "playwright test", 10 | "start": "npm run dev" 11 | }, 12 | "dependencies": { 13 | "@alita/flow": "workspace:*", 14 | "@ant-design/icons": "^4.7.0", 15 | "alita": "workspace:*", 16 | "antd": "^4.21.2", 17 | "@ant-design/pro-components": "^2.3.8" 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /examples/tabs-routes/plugin.ts: -------------------------------------------------------------------------------- 1 | import { IApi } from 'umi'; 2 | 3 | export default (api: IApi) => { 4 | api.onDevCompileDone((opts) => { 5 | opts; 6 | // console.log('> onDevCompileDone', opts.isFirstCompile); 7 | }); 8 | api.onBuildComplete((opts) => { 9 | opts; 10 | // console.log('> onBuildComplete', opts.isFirstCompile); 11 | }); 12 | }; 13 | -------------------------------------------------------------------------------- /examples/tabs-routes/src/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/examples/tabs-routes/src/assets/logo.png -------------------------------------------------------------------------------- /examples/tabs-routes/src/pages/demo1/demo11/index.tsx: -------------------------------------------------------------------------------- 1 | export default () => { 2 | return
demo11
; 3 | }; 4 | -------------------------------------------------------------------------------- /examples/tabs-routes/src/pages/demo1/demo12/index.tsx: -------------------------------------------------------------------------------- 1 | export default () => { 2 | return
demo12
; 3 | }; 4 | -------------------------------------------------------------------------------- /examples/tabs-routes/src/pages/demo2/demo21/demo211/index.tsx: -------------------------------------------------------------------------------- 1 | export default () => { 2 | return
demo211
; 3 | }; 4 | -------------------------------------------------------------------------------- /examples/tabs-routes/src/pages/foo/index.tsx: -------------------------------------------------------------------------------- 1 | export default () =>

user: Foo

; 2 | -------------------------------------------------------------------------------- /examples/tabs-routes/src/pages/index.tsx: -------------------------------------------------------------------------------- 1 | import { history } from 'alita'; 2 | import { Button } from 'antd'; 3 | 4 | export default () => ( 5 | 13 | ); 14 | -------------------------------------------------------------------------------- /examples/tabs-routes/typings.d.ts: -------------------------------------------------------------------------------- 1 | declare module '*.css'; 2 | declare module '*.less'; 3 | declare module '*.scss'; 4 | declare module '*.sass'; 5 | declare module '*.svg'; 6 | declare module '*.png'; 7 | declare module '*.jpg'; 8 | declare module '*.jpeg'; 9 | declare module '*.gif'; 10 | declare module '*.bmp'; 11 | declare module '*.tiff'; 12 | declare module '*.json'; 13 | 14 | -------------------------------------------------------------------------------- /examples/tabs/.env: -------------------------------------------------------------------------------- 1 | PORT=8986 2 | -------------------------------------------------------------------------------- /examples/tabs/.gitignore: -------------------------------------------------------------------------------- 1 | /.env.local 2 | /.umirc.local.ts 3 | /.umirc.local.js 4 | /config/config.local.ts 5 | /config/config.local.js 6 | /src/.umi 7 | /.umi 8 | -------------------------------------------------------------------------------- /examples/tabs/e2e/tabs.test.ts: -------------------------------------------------------------------------------- 1 | import { expect, test } from '@playwright/test'; 2 | 3 | test.beforeEach(async ({ page }) => { 4 | await page.goto('http://localhost:8986/'); 5 | }); 6 | 7 | test.describe('basic', () => { 8 | test('render', async ({ page }) => { 9 | await expect( 10 | page.getByText('Hello Alita, Click Me Close This Tab!'), 11 | ).toBeVisible(); 12 | }); 13 | }); 14 | -------------------------------------------------------------------------------- /examples/tabs/mock/app.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | '/api/hello': { 3 | text: 'Alita', 4 | }, 5 | }; 6 | -------------------------------------------------------------------------------- /examples/tabs/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@examples/tabs", 3 | "private": true, 4 | "scripts": { 5 | "dev": "alita dev", 6 | "build": "ANALYZE=1 alita build", 7 | "plugin": "alita plugin list", 8 | "test:e2e": "start-test dev :8986/__umi/api/status test:pw", 9 | "test:pw": "playwright test", 10 | "start": "npm run dev" 11 | }, 12 | "dependencies": { 13 | "@alita/flow": "workspace:*", 14 | "@ant-design/icons": "^4.7.0", 15 | "alita": "workspace:*", 16 | "antd": "^4.24.8" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /examples/tabs/plugin.ts: -------------------------------------------------------------------------------- 1 | import { IApi } from 'umi'; 2 | 3 | export default (api: IApi) => { 4 | api.onDevCompileDone((opts) => { 5 | opts; 6 | // console.log('> onDevCompileDone', opts.isFirstCompile); 7 | }); 8 | api.onBuildComplete((opts) => { 9 | opts; 10 | // console.log('> onBuildComplete', opts.isFirstCompile); 11 | }); 12 | }; 13 | -------------------------------------------------------------------------------- /examples/tabs/src/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/examples/tabs/src/assets/logo.png -------------------------------------------------------------------------------- /examples/tabs/src/global.less: -------------------------------------------------------------------------------- 1 | .runtime-keep-alive-layout > .ant-tabs-card .ant-tabs-tab-active { 2 | background: #fff; 3 | border-color: #fff; 4 | } 5 | -------------------------------------------------------------------------------- /examples/tabs/src/locales/en-US.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | welcome: 'welcome to umi', 3 | 'tabs.close.left': 'Close Left', 4 | 'tabs.close.right': 'Close Right', 5 | 'tabs.close.others': 'Close Others', 6 | 'tabs.refresh': 'Refresh', 7 | 'tabs.warning': 'please remain at least one tab', 8 | }; 9 | -------------------------------------------------------------------------------- /examples/tabs/src/locales/zh-CN.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | welcome: '欢迎光临 Umi 的世界!', 3 | 'tabs.close.left': '关闭左侧', 4 | 'tabs.close.right': '关闭右侧', 5 | 'tabs.close.others': '关闭其他', 6 | 'tabs.refresh': '刷新', 7 | 'tabs.warning': '至少要保留一个窗口', 8 | }; 9 | -------------------------------------------------------------------------------- /examples/tabs/src/pages/index.less: -------------------------------------------------------------------------------- 1 | .title { 2 | font-size: 30px; 3 | } 4 | .adm-button{ 5 | font-size: 30px 6 | } -------------------------------------------------------------------------------- /examples/tabs/src/pages/index.tsx: -------------------------------------------------------------------------------- 1 | import { closeTab } from 'alita'; 2 | import React from 'react'; 3 | import styles from './index.less'; 4 | export default () => ( 5 |
{ 8 | closeTab('/'); 9 | }} 10 | > 11 | Hello Alita, Click Me Close This Tab! 12 |
13 | ); 14 | -------------------------------------------------------------------------------- /examples/tabs/src/services/api.ts: -------------------------------------------------------------------------------- 1 | import { request } from '@@/plugin-request'; 2 | 3 | export async function query(): Promise { 4 | return request('/hello'); 5 | } 6 | -------------------------------------------------------------------------------- /examples/tabs/typings.d.ts: -------------------------------------------------------------------------------- 1 | declare module '*.css'; 2 | declare module '*.less'; 3 | declare module '*.scss'; 4 | declare module '*.sass'; 5 | declare module '*.svg'; 6 | declare module '*.png'; 7 | declare module '*.jpg'; 8 | declare module '*.jpeg'; 9 | declare module '*.gif'; 10 | declare module '*.bmp'; 11 | declare module '*.tiff'; 12 | declare module '*.json'; 13 | 14 | -------------------------------------------------------------------------------- /examples/test-test/.umirc.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | npmClient: 'pnpm', 3 | }; 4 | -------------------------------------------------------------------------------- /examples/test-test/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # @example/test-test 2 | 3 | ## null 4 | 5 | ### Patch Changes 6 | 7 | - Updated dependencies [[`f652e733`](https://github.com/alitajs/alita/commit/f652e733d4aefd93673e75688e0d7ce279fca3b2)]: 8 | - alita@3.2.10 9 | -------------------------------------------------------------------------------- /examples/test-test/components/Greet/Greet.tsx: -------------------------------------------------------------------------------- 1 | import React, { MouseEventHandler } from 'react'; 2 | 3 | export default function Greet({ 4 | name, 5 | onClick, 6 | }: { 7 | name?: string; 8 | onClick?: MouseEventHandler; 9 | }) { 10 | return ( 11 |
12 | Hello {name || 'Anonymous'} 13 |
14 | ); 15 | } 16 | -------------------------------------------------------------------------------- /examples/test-test/components/Greet/__snapshots__/Greet.test.tsx.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`renders Greet without name by snapshot 1`] = ` 4 |
5 |
6 | Hello 7 | 8 | Anonymous 9 | 10 |
11 |
12 | `; 13 | -------------------------------------------------------------------------------- /examples/test-test/components/Greet/index.ts: -------------------------------------------------------------------------------- 1 | import Greet from './Greet'; 2 | 3 | export default Greet; 4 | export * from './Greet'; 5 | -------------------------------------------------------------------------------- /examples/test-test/foo.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/examples/test-test/foo.css -------------------------------------------------------------------------------- /examples/test-test/foo.test.ts: -------------------------------------------------------------------------------- 1 | // @ts-ignore 2 | import styles from './foo.css'; 3 | 4 | test('fetch polyfill', () => { 5 | expect(typeof fetch).toEqual('function'); 6 | }); 7 | 8 | test('jsdom', () => { 9 | expect(typeof window).toBe('object'); 10 | const element = document.createElement('div'); 11 | expect(element).not.toBeNull(); 12 | }); 13 | 14 | test('css modules', () => { 15 | expect(styles.foo).toEqual('foo'); 16 | }); 17 | 18 | test('class', () => { 19 | class A { 20 | public foo() { 21 | return 'foo'; 22 | } 23 | } 24 | const a = new A(); 25 | expect(a.foo()).toEqual('foo'); 26 | }); 27 | -------------------------------------------------------------------------------- /examples/test-test/jest.config.ts: -------------------------------------------------------------------------------- 1 | import { Config, configUmiAlias, createConfig } from 'alita/test'; 2 | 3 | const jestConfig = createConfig({ 4 | target: 'browser', 5 | }); 6 | 7 | export default async () => { 8 | return (await configUmiAlias({ 9 | ...jestConfig, 10 | })) as Config.InitialOptions; 11 | }; 12 | -------------------------------------------------------------------------------- /examples/test-test/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@example/test-test", 3 | "private": true, 4 | "scripts": { 5 | "test": "jest", 6 | "start": "npm run dev" 7 | }, 8 | "dependencies": { 9 | "alita": "workspace:*" 10 | }, 11 | "devDependencies": { 12 | "react": "17", 13 | "react-dom": "17", 14 | "@testing-library/jest-dom": "^5.16.4", 15 | "@testing-library/react": "^12", 16 | "@types/jest": "^27.5.1", 17 | "jest": "^27", 18 | "ts-node": "^10", 19 | "typescript": "^4.7.2" 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /examples/test-test/pages/index.less: -------------------------------------------------------------------------------- 1 | 2 | .title { 3 | background: rgb(184, 121, 242); 4 | } 5 | -------------------------------------------------------------------------------- /examples/test-test/pages/index.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import styles from './index.less'; 3 | 4 | export default function Page() { 5 | return ( 6 |
7 |

Page index

8 |
9 | ); 10 | } 11 | -------------------------------------------------------------------------------- /examples/test-test/utils/reverseApiData.ts: -------------------------------------------------------------------------------- 1 | export async function reverseApiData(url: string, fetcher = fetch) { 2 | const res = await fetcher(url); 3 | const json = await res.json(); 4 | 5 | const { data = {} } = json; 6 | const reversed: Record = {}; 7 | for (const key of Object.keys(data)) { 8 | const val = data[key]; 9 | reversed[val] = key; 10 | } 11 | return reversed; 12 | } 13 | -------------------------------------------------------------------------------- /examples/with-azure/.env: -------------------------------------------------------------------------------- 1 | PORT=8888 -------------------------------------------------------------------------------- /examples/with-azure/.gitignore: -------------------------------------------------------------------------------- 1 | /.env.local 2 | /.umirc.local.ts 3 | /.umirc.local.js 4 | /config/config.local.ts 5 | /config/config.local.js 6 | /src/.umi 7 | /.umi 8 | -------------------------------------------------------------------------------- /examples/with-azure/config/config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'alita'; 2 | 3 | export default defineConfig({ 4 | appType: 'h5', 5 | // 这个值在 appts 中被 getKeepAlive 修改 6 | keepalive: [/./], 7 | mobileLayout: true, 8 | legacyBuild: false, 9 | // mainPath:'users', 10 | mfsu: false, 11 | hash: false, 12 | reactRouter5Compat: {}, 13 | exportStatic: {}, 14 | plugins: [require.resolve('./pluginazure')], 15 | azure: { 16 | apiVersion: '2023-07-01-preview', 17 | model: 'alita4', 18 | resource: 'alita', 19 | }, 20 | }); 21 | -------------------------------------------------------------------------------- /examples/with-azure/config/pluginazure.ts: -------------------------------------------------------------------------------- 1 | import { IApi } from 'umi'; 2 | import type { IOnIntlAzure, IAzureSend } from '@alita/plugin-azure'; 3 | 4 | let _send: IAzureSend; 5 | export default (api: IApi & { onIntlAzure: IOnIntlAzure }) => { 6 | // api.onIntlAzure(async ({ send }) => { 7 | // _send = send; 8 | // }); 9 | // api.onDevCompileDone(async () => { 10 | // const result = await _send('你好'); 11 | // console.log(result.choices[0]!.message?.content); 12 | // }); 13 | }; 14 | -------------------------------------------------------------------------------- /examples/with-azure/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@examples/azure", 3 | "private": true, 4 | "scripts": { 5 | "call": "alita call", 6 | "dev": "alita dev", 7 | "build": "alita build", 8 | "start": "npm run dev" 9 | }, 10 | "dependencies": { 11 | "@alita/flow": "workspace:*", 12 | "alita": "workspace:*", 13 | "antd-mobile": "^5.10.0" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /examples/with-azure/src/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/examples/with-azure/src/favicon.ico -------------------------------------------------------------------------------- /examples/with-azure/src/pages/index/index.less: -------------------------------------------------------------------------------- 1 | .title { 2 | font-size: 30px; 3 | :global { 4 | .adm-button{ 5 | font-size: 30px 6 | } 7 | } 8 | } 9 | 10 | .adm-button{ 11 | font-size: 30px 12 | } -------------------------------------------------------------------------------- /examples/with-azure/src/pages/index/index.tsx: -------------------------------------------------------------------------------- 1 | import { Button } from 'antd-mobile'; 2 | import React, { useState } from 'react'; 3 | import styles from './index.less'; 4 | import { sendOpenAI } from 'alita'; 5 | export default () => { 6 | const [message, setMessage] = useState(); 7 | return ( 8 | <> 9 |
10 | {message} 11 | 24 |
25 | 26 | ); 27 | }; 28 | -------------------------------------------------------------------------------- /examples/with-azure/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./src/.umi/tsconfig.json" 3 | } 4 | -------------------------------------------------------------------------------- /examples/with-azure/typings.d.ts: -------------------------------------------------------------------------------- 1 | import 'alita/typings'; -------------------------------------------------------------------------------- /logo.1png.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/logo.1png.png -------------------------------------------------------------------------------- /logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/logo.png -------------------------------------------------------------------------------- /packages/alita/bin/alita.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | // setNodeTitle 3 | process.title = 'alita'; 4 | // Use magic to suppress node deprecation warnings 5 | // See: https://github.com/nodejs/node/blob/master/lib/internal/process/warning.js#L77 6 | // @ts-ignore 7 | process.noDeprecation = '1'; 8 | process.env.DID_YOU_KNOW = 'none'; 9 | // 关闭 umi 你知道吗 功能 10 | // TODO: [你知道吗] 这个功能很好,但是有些提示在做配置内收的 alita 里面提示出来,感觉怪怪的。比如推荐 @umijs/max。所以先关掉,想想该怎么处理 11 | process.env.DID_YOU_KNOW = 'none'; 12 | // disable since it's conflicted with typescript cjs + dynamic import 13 | // require('v8-compile-cache'); 14 | require('../dist/cli') 15 | .run() 16 | .catch((e) => { 17 | console.error(e); 18 | process.exit(1); 19 | }); -------------------------------------------------------------------------------- /packages/alita/eslint.js: -------------------------------------------------------------------------------- 1 | module.exports = require('umi/eslint'); 2 | -------------------------------------------------------------------------------- /packages/alita/fixtures/generate/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/packages/alita/fixtures/generate/.gitkeep -------------------------------------------------------------------------------- /packages/alita/index.d.ts: -------------------------------------------------------------------------------- 1 | // @ts-ignore 2 | export * from '@@/exports'; 3 | export * from './dist'; 4 | -------------------------------------------------------------------------------- /packages/alita/index.esm.js: -------------------------------------------------------------------------------- 1 | export * from 'umi'; -------------------------------------------------------------------------------- /packages/alita/index.js: -------------------------------------------------------------------------------- 1 | const umiExports = require('umi'); 2 | module.exports = umiExports; 3 | -------------------------------------------------------------------------------- /packages/alita/prettier.js: -------------------------------------------------------------------------------- 1 | module.exports = require('umi/prettier'); 2 | -------------------------------------------------------------------------------- /packages/alita/src/constants.ts: -------------------------------------------------------------------------------- 1 | export const MIN_NODE_VERSION = 14; 2 | export const DEV_COMMAND = 'dev'; 3 | export const FRAMEWORK_NAME = 'alita'; 4 | -------------------------------------------------------------------------------- /packages/alita/src/features/alitaloading.ts: -------------------------------------------------------------------------------- 1 | import { cheerio } from '@umijs/utils'; 2 | import { readFileSync } from 'fs'; 3 | import { join } from 'path'; 4 | import { IApi } from 'umi'; 5 | 6 | const assetsDir = join(__dirname, '../../assets'); 7 | 8 | export default (api: IApi) => { 9 | api.register({ 10 | key: 'modifyDevToolLoadingHTML', 11 | fn: () => 12 | cheerio.load( 13 | readFileSync(join(assetsDir, 'bundle-status.html'), 'utf-8'), 14 | ), 15 | }); 16 | }; 17 | -------------------------------------------------------------------------------- /packages/alita/src/features/apptype.ts: -------------------------------------------------------------------------------- 1 | import { IApi } from 'umi'; 2 | 3 | export default (api: IApi) => { 4 | api.describe({ 5 | key: 'appType', 6 | config: { 7 | schema(Joi) { 8 | return Joi.string().valid( 9 | 'h5', 10 | 'pc', 11 | 'docs', 12 | 'cordova', 13 | 'micro', 14 | 'native', 15 | ); 16 | }, 17 | default: 'h5', 18 | }, 19 | }); 20 | }; 21 | -------------------------------------------------------------------------------- /packages/alita/src/features/config/schema.ts: -------------------------------------------------------------------------------- 1 | import type { Root } from '@umijs/utils/compiled/@hapi/joi'; 2 | 3 | export function getSchemas(): Record any> { 4 | // 这是一些只有配置没有功能的设置,可能是配置项会在多个插件中使用 5 | return { 6 | displayIcon: (Joi) => Joi.string(), 7 | // native plugin 中注册 8 | // displayName: (Joi) => Joi.string(), 9 | // packageId: (Joi) => Joi.string(), 10 | complexRoute: (Joi) => Joi.boolean(), 11 | retainLog: (Joi) => Joi.boolean(), 12 | }; 13 | } 14 | -------------------------------------------------------------------------------- /packages/alita/src/features/legacy.ts: -------------------------------------------------------------------------------- 1 | import { IApi } from 'umi'; 2 | 3 | export default (api: IApi) => { 4 | api.describe({ 5 | key: 'legacyBuild', 6 | config: { 7 | schema(Joi) { 8 | return Joi.boolean(); 9 | }, 10 | }, 11 | }); 12 | api.onStart(() => { 13 | if (!api.userConfig.legacy) { 14 | // const text = 15 | // '[WARN] 为了构建默认快,alita@3.3+ 之后移除了默认 legacy 配置,如果你的项目有低版本浏览器兼容,请在配置文件中使用 legacy:{} '; 16 | // logger.warn(text); 17 | // logger.warn(text); 18 | // logger.warn(text); 19 | // logger.warn('不想看到这个提示,请在配置文件中增加 legacyBuild:false '); 20 | // logger.warn('我们将会在以后的版本中,移除这些提示'); 21 | } 22 | }); 23 | }; 24 | -------------------------------------------------------------------------------- /packages/alita/src/index.ts: -------------------------------------------------------------------------------- 1 | // @ts-ignore 2 | export * from '@alita/types'; 3 | export * from 'umi'; 4 | export { run } from './cli'; 5 | -------------------------------------------------------------------------------- /packages/alita/stylelint.js: -------------------------------------------------------------------------------- 1 | module.exports = require('umi/stylelint'); 2 | -------------------------------------------------------------------------------- /packages/alita/templates/generate/page/index.less.tpl: -------------------------------------------------------------------------------- 1 | .center { 2 | background-color: {{{ color }}}; 3 | } 4 | -------------------------------------------------------------------------------- /packages/alita/templates/generate/page/index.tsx.tpl: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import type { FC } from 'react'; 3 | import { useRequest } from 'alita'; 4 | import { query } from './service'; 5 | import styles from './index.less'; 6 | 7 | interface {{{ name }}}PageProps {} 8 | 9 | const {{{ name }}}Page: FC<{{{ name }}}PageProps> = () => { 10 | const { data } = useRequest(query); 11 | return
Hello {data?.text}
; 12 | }; 13 | 14 | export default {{{ name }}}Page; 15 | -------------------------------------------------------------------------------- /packages/alita/templates/generate/page/service.ts.tpl: -------------------------------------------------------------------------------- 1 | import { request } from 'alita'; 2 | 3 | export async function query(): Promise { 4 | return request('/api/hello', { method: 'post' }); 5 | } 6 | -------------------------------------------------------------------------------- /packages/alita/test.d.ts: -------------------------------------------------------------------------------- 1 | export * from 'umi/test'; 2 | -------------------------------------------------------------------------------- /packages/alita/test.js: -------------------------------------------------------------------------------- 1 | // upper framework should also set env.UMI_PRESETS 2 | // upper framework first 3 | process.env.UMI_PRESETS = 4 | process.env.UMI_PRESETS || [require.resolve('./dist/preset')].join(','); 5 | module.exports = require('umi/test'); 6 | -------------------------------------------------------------------------------- /packages/alita/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "outDir": "./dist", 5 | "rootDir": "./src" 6 | }, 7 | "include": ["src"] 8 | } 9 | -------------------------------------------------------------------------------- /packages/autoimport/README.md: -------------------------------------------------------------------------------- 1 | # @alita/autoimport 2 | 3 | See our website [alitajs](https://alitajs.com) for more information. 4 | 5 | ## 安装使用 6 | 7 | ``` 8 | pnpm i @alita/autoimport 9 | 10 | plugins:['@alita/autoimport'] 11 | 12 | autoImport:{ 13 | libs:[ ], 14 | } 15 | ``` 16 | 17 | ## api.addLowImportLibs 18 | 19 | 20 | ```ts 21 | api.addLowImportLibs(()=>[ 22 | // import * as xxx from 'xxx'; 23 | { namespaceImport: 'xxx' }, 24 | // import xxx from 'xxx'; 25 | { defaultImport: 'xx' }, 26 | // import { 'computed', 'ref' } from 'xxx'; 27 | { importFrom: 'xxx', members: ['computed', 'ref'] }, 28 | ]) 29 | ``` 30 | 31 | 32 | -------------------------------------------------------------------------------- /packages/autoimport/src/types.ts: -------------------------------------------------------------------------------- 1 | export interface ILib { 2 | // 通常是包名 3 | importFrom: string; 4 | // 成员列表 5 | members?: string[]; 6 | // 如有配置,用 obj.prop 的方式使用,比如 techui 7 | withObj?: string; 8 | // 是否是 import * as xx from 'xx'; 的方式 9 | namespaceImport?: string; 10 | // 是否是 import xx from 'xx'; 的方式 11 | defaultImport?: string; 12 | } 13 | 14 | export interface IOpts { 15 | withObjs: Record; 16 | identifierToLib: Record; 17 | defaultToLib: Record; 18 | namespaceToLib: Record; 19 | } 20 | -------------------------------------------------------------------------------- /packages/autoimport/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "outDir": "./dist", 5 | "rootDir": "./src" 6 | }, 7 | "include": ["src"] 8 | } 9 | -------------------------------------------------------------------------------- /packages/chalk/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@alita/chalk", 3 | "version": "1.1.2", 4 | "description": "@alita/browser-chalk", 5 | "main": "dist/index.js", 6 | "types": "dist/index.d.ts", 7 | "files": [ 8 | "dist", 9 | "compiled" 10 | ], 11 | "scripts": { 12 | "build": "pnpm tsc", 13 | "build:deps": "umi-scripts bundleDeps", 14 | "dev": "pnpm build --watch", 15 | "test": "umi-scripts jest-turbo" 16 | }, 17 | "repository": { 18 | "type": "git", 19 | "url": "https://github.com/alitajs/alita" 20 | }, 21 | "authors": [ 22 | "xiaohuoni (https://github.com/xiaohuoni)" 23 | ], 24 | "license": "MIT", 25 | "bugs": "https://github.com/alitajs/alita/issues", 26 | "homepage": "https://github.com/alitajs/alita/tree/master/packages/chalk#readme", 27 | "publishConfig": { 28 | "access": "public" 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /packages/chalk/src/index.test.ts: -------------------------------------------------------------------------------- 1 | import chalk from './index'; 2 | 3 | test('color utils', () => { 4 | expect(chalk.red('123')).toEqual(['%c123', 'color:#FF0000']); 5 | }); 6 | 7 | test('color add', () => { 8 | expect(chalk.add(chalk.red('123'), chalk.blue('456'))).toEqual([ 9 | ' %c123 %c456', 10 | 'color:#FF0000', 11 | 'color:#0000FF', 12 | ]); 13 | }); 14 | 15 | test('hello', () => { 16 | expect(chalk.hello('Alita', '3.0.0')).toEqual(undefined); 17 | }); 18 | -------------------------------------------------------------------------------- /packages/chalk/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "outDir": "./dist", 5 | "rootDir": "./src", 6 | "target": "ES5" 7 | }, 8 | "include": ["src"] 9 | } 10 | -------------------------------------------------------------------------------- /packages/create-alita/README.md: -------------------------------------------------------------------------------- 1 | # create-alita 2 | 3 | See our website [alitajs](https://alitajs.com) for more information. -------------------------------------------------------------------------------- /packages/create-alita/bin/create-alita.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | require('../dist/cli'); 4 | -------------------------------------------------------------------------------- /packages/create-alita/fixtures/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/packages/create-alita/fixtures/.gitkeep -------------------------------------------------------------------------------- /packages/create-alita/src/cli.ts: -------------------------------------------------------------------------------- 1 | import { chalk, yParser } from '@umijs/utils'; 2 | import { existsSync } from 'fs'; 3 | import { join } from 'path'; 4 | 5 | const args = yParser(process.argv.slice(2), { 6 | alias: { 7 | version: ['v'], 8 | help: ['h'], 9 | }, 10 | boolean: ['version'], 11 | }); 12 | 13 | if (args.version && !args._[0]) { 14 | args._[0] = 'version'; 15 | const local = existsSync(join(__dirname, '../.local')) 16 | ? chalk.cyan('@local') 17 | : ''; 18 | const { name, version } = require('../package.json'); 19 | console.log(`${name}@${version}${local}`); 20 | } else { 21 | require('./') 22 | .default({ 23 | cwd: process.cwd(), 24 | args, 25 | }) 26 | .catch((err: Error) => { 27 | console.error(`Create failed, ${err.message}`); 28 | console.error(err); 29 | }); 30 | } 31 | -------------------------------------------------------------------------------- /packages/create-alita/templates/app/.editorconfig.tpl: -------------------------------------------------------------------------------- 1 | # http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | indent_style = space 6 | indent_size = 2 7 | end_of_line = lf 8 | charset = utf-8 9 | trim_trailing_whitespace = true 10 | insert_final_newline = true 11 | 12 | [*.md] 13 | trim_trailing_whitespace = false 14 | 15 | [Makefile] 16 | indent_style = tab 17 | -------------------------------------------------------------------------------- /packages/create-alita/templates/app/.eslintignore.tpl: -------------------------------------------------------------------------------- 1 | /scripts 2 | .history 3 | public 4 | dist 5 | .umi 6 | mock -------------------------------------------------------------------------------- /packages/create-alita/templates/app/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | extends: require.resolve('alita/eslint'), 3 | rules: { 4 | 'selector-class-pattern': 0, 5 | }, 6 | }; 7 | -------------------------------------------------------------------------------- /packages/create-alita/templates/app/.gitignore.tpl: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | **/node_modules 5 | 6 | # production 7 | /dist 8 | .mfsu 9 | # misc 10 | .DS_Store 11 | npm-debug.log* 12 | yarn-error.log 13 | 14 | /coverage 15 | .idea 16 | yarn.lock 17 | package-lock.json 18 | pnpm-lock.yaml 19 | *bak 20 | 21 | 22 | # visual studio code 23 | .history 24 | *.log 25 | functions/* 26 | .temp/** 27 | 28 | # umi 29 | .umi 30 | .umi-production 31 | /.env.local 32 | /.umirc.local.ts 33 | /.umirc.local.js 34 | /config/config.local.ts 35 | /config/config.local.js 36 | 37 | # screenshot 38 | screenshot 39 | .firebase 40 | .eslintcache 41 | 42 | build 43 | -------------------------------------------------------------------------------- /packages/create-alita/templates/app/.npmrc.tpl: -------------------------------------------------------------------------------- 1 | registry=https://registry.npmjs.org/ 2 | -------------------------------------------------------------------------------- /packages/create-alita/templates/app/.prettierignore.tpl: -------------------------------------------------------------------------------- 1 | node_modules 2 | .umi 3 | .umi-production 4 | *.png 5 | *.jpg 6 | *.svg 7 | .editorconfig 8 | .env 9 | .prettierignore 10 | .gitkeep 11 | .DS_Store 12 | .npmrc 13 | .eslintignore 14 | .gitignore -------------------------------------------------------------------------------- /packages/create-alita/templates/app/.prettierrc.js.tpl: -------------------------------------------------------------------------------- 1 | const prettier = require('alita/prettier'); 2 | 3 | module.exports = { 4 | ...prettier, 5 | }; 6 | -------------------------------------------------------------------------------- /packages/create-alita/templates/app/.stylelintrc.js.tpl: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | extends: require.resolve('alita/stylelint'), 3 | }; 4 | -------------------------------------------------------------------------------- /packages/create-alita/templates/app/config/config.ts.tpl: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'alita'; 2 | 3 | export default defineConfig({ 4 | appType: 'h5', 5 | keepalive: [/list/], 6 | aconsole: { 7 | console: {}, 8 | inspx: {}, 9 | }, 10 | mobileLayout: 'mobile5', 11 | mfsu: {}, 12 | hash: false, 13 | npmClient: '{{{ npmClient }}}' 14 | }); 15 | -------------------------------------------------------------------------------- /packages/create-alita/templates/app/jest-setup.ts: -------------------------------------------------------------------------------- 1 | import '@testing-library/jest-dom'; 2 | -------------------------------------------------------------------------------- /packages/create-alita/templates/app/jest.config.ts: -------------------------------------------------------------------------------- 1 | import { Config, configUmiAlias, createConfig } from 'alita/test'; 2 | 3 | export default async () => { 4 | return (await configUmiAlias({ 5 | ...createConfig({ 6 | target: 'browser', 7 | }), 8 | setupFilesAfterEnv: ['/jest-setup.ts'], 9 | // if you require some es-module npm package, please uncomment below line and insert your package name 10 | // transformIgnorePatterns: ['node_modules/(?!.*(lodash-es|your-es-pkg-name)/)'] 11 | transformIgnorePatterns: [ 12 | 'node_modules/(?!.*(@umijs/renderer-react|umi/client/client/|@umijs/plugins/libs|antd-mobile/es/))', 13 | ], 14 | })) as Config.InitialOptions; 15 | }; 16 | -------------------------------------------------------------------------------- /packages/create-alita/templates/app/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/packages/create-alita/templates/app/logo.png -------------------------------------------------------------------------------- /packages/create-alita/templates/app/mock/app.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | 'POST /api/hello': { 3 | text: 'Antd Mobile', 4 | }, 5 | }; 6 | -------------------------------------------------------------------------------- /packages/create-alita/templates/app/plugin.ts: -------------------------------------------------------------------------------- 1 | import { IApi } from 'alita'; 2 | 3 | export default (api: IApi) => { 4 | api.onDevCompileDone((opts) => { 5 | // console.log('> onDevCompileDone', opts.isFirstCompile); 6 | }); 7 | api.onBuildComplete((opts) => { 8 | // console.log('> onBuildComplete', opts.isFirstCompile); 9 | }); 10 | }; 11 | -------------------------------------------------------------------------------- /packages/create-alita/templates/app/src/assets/demoIcon/home.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/packages/create-alita/templates/app/src/assets/demoIcon/home.png -------------------------------------------------------------------------------- /packages/create-alita/templates/app/src/assets/demoIcon/home1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/packages/create-alita/templates/app/src/assets/demoIcon/home1.png -------------------------------------------------------------------------------- /packages/create-alita/templates/app/src/assets/demoIcon/list.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/packages/create-alita/templates/app/src/assets/demoIcon/list.png -------------------------------------------------------------------------------- /packages/create-alita/templates/app/src/assets/demoIcon/list1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/packages/create-alita/templates/app/src/assets/demoIcon/list1.png -------------------------------------------------------------------------------- /packages/create-alita/templates/app/src/assets/demoIcon/setting.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/packages/create-alita/templates/app/src/assets/demoIcon/setting.png -------------------------------------------------------------------------------- /packages/create-alita/templates/app/src/assets/demoIcon/setting1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/packages/create-alita/templates/app/src/assets/demoIcon/setting1.png -------------------------------------------------------------------------------- /packages/create-alita/templates/app/src/assets/yay.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/packages/create-alita/templates/app/src/assets/yay.jpg -------------------------------------------------------------------------------- /packages/create-alita/templates/app/src/components/SearchBar/__tests__/index.test.tsx: -------------------------------------------------------------------------------- 1 | import { render } from '@testing-library/react'; 2 | import SearchBar from '..'; 3 | 4 | describe('SearchBar', () => { 5 | it('Render correctly', () => { 6 | const { container } = render(); 7 | expect(container).toMatchSnapshot(); 8 | }); 9 | }); 10 | -------------------------------------------------------------------------------- /packages/create-alita/templates/app/src/components/SearchBar/index.less: -------------------------------------------------------------------------------- 1 | .search-bar-wrap { 2 | padding: 24px; 3 | } 4 | -------------------------------------------------------------------------------- /packages/create-alita/templates/app/src/components/SearchBar/index.tsx: -------------------------------------------------------------------------------- 1 | import { SearchBar } from 'antd-mobile'; 2 | import './index.less'; 3 | 4 | export default () => ( 5 |
6 | 7 |
8 | ); 9 | -------------------------------------------------------------------------------- /packages/create-alita/templates/app/src/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/packages/create-alita/templates/app/src/favicon.ico -------------------------------------------------------------------------------- /packages/create-alita/templates/app/src/global.css: -------------------------------------------------------------------------------- 1 | html, 2 | body, 3 | #root { 4 | height: 100%; 5 | } 6 | 7 | body { 8 | margin: 0; 9 | } 10 | -------------------------------------------------------------------------------- /packages/create-alita/templates/app/src/models/index.ts: -------------------------------------------------------------------------------- 1 | import { query } from '@/services/api'; 2 | import type { DvaModel } from 'alita'; 3 | 4 | export interface IndexModelState { 5 | name: string; 6 | } 7 | 8 | const IndexModel: DvaModel = { 9 | namespace: 'index', 10 | 11 | state: { 12 | name: 'Hello Alita', 13 | }, 14 | 15 | effects: { 16 | *query({ payload }, { call, put }) { 17 | const data = yield call(query, payload); 18 | yield put({ 19 | type: 'save', 20 | payload: { name: data.text }, 21 | }); 22 | }, 23 | }, 24 | reducers: { 25 | save(state, action) { 26 | return { 27 | ...state, 28 | ...action.payload, 29 | }; 30 | }, 31 | }, 32 | }; 33 | 34 | export default IndexModel; 35 | -------------------------------------------------------------------------------- /packages/create-alita/templates/app/src/models/todo.ts: -------------------------------------------------------------------------------- 1 | import { useState } from 'react'; 2 | 3 | export default function () { 4 | const [todos, setTodos] = useState(['foo', 'bar']); 5 | return { 6 | todos, 7 | setTodos, 8 | }; 9 | } 10 | -------------------------------------------------------------------------------- /packages/create-alita/templates/app/src/pages/index/index.css: -------------------------------------------------------------------------------- 1 | .normal { 2 | font-family: Georgia, sans-serif; 3 | margin-top: 4em; 4 | text-align: center; 5 | } 6 | 7 | .welcome { 8 | height: 512px; 9 | background: url('~@/assets/yay.jpg') no-repeat center 0; 10 | background-size: 512px 512px; 11 | } 12 | 13 | .description { 14 | font-size: 35px; 15 | margin: 18px 0 0; 16 | } 17 | 18 | .description code { 19 | background: #f7f7f7; 20 | } 21 | -------------------------------------------------------------------------------- /packages/create-alita/templates/app/src/pages/index/index.tsx: -------------------------------------------------------------------------------- 1 | import { useNavigate } from 'alita'; 2 | import { Button } from 'antd-mobile'; 3 | import styles from './index.css'; 4 | 5 | export default function ({}) { 6 | const navigate = useNavigate(); 7 | return ( 8 |
9 |
10 |

11 | To get started, edit src/pages/index.js and save to reload. 12 |

13 | 22 |
23 | ); 24 | } 25 | -------------------------------------------------------------------------------- /packages/create-alita/templates/app/src/pages/list/index.less: -------------------------------------------------------------------------------- 1 | .list-icon { 2 | width: 150px !important; 3 | height: 150px !important; 4 | } 5 | -------------------------------------------------------------------------------- /packages/create-alita/templates/app/src/services/api.ts: -------------------------------------------------------------------------------- 1 | import { request } from 'alita'; 2 | 3 | export async function query(): Promise { 4 | return request('/api/hello', { method: 'POST' }); 5 | } 6 | -------------------------------------------------------------------------------- /packages/create-alita/templates/app/tsconfig.json.tpl: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./src/.umi/tsconfig.json" 3 | } 4 | -------------------------------------------------------------------------------- /packages/create-alita/templates/app/typings.d.ts: -------------------------------------------------------------------------------- 1 | import 'alita/typings'; 2 | -------------------------------------------------------------------------------- /packages/create-alita/templates/plugin/.fatherrc.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | target: 'node', 3 | cjs: { type: 'babel', lazy: true }, 4 | disableTypeCheck: true, 5 | }; 6 | -------------------------------------------------------------------------------- /packages/create-alita/templates/plugin/.gitignore.tpl: -------------------------------------------------------------------------------- 1 | node_modules 2 | lib -------------------------------------------------------------------------------- /packages/create-alita/templates/plugin/.npmrc.tpl: -------------------------------------------------------------------------------- 1 | registry={{{ registry }}} 2 | -------------------------------------------------------------------------------- /packages/create-alita/templates/plugin/README.md.tpl: -------------------------------------------------------------------------------- 1 | # {{{ name }}} 2 | 3 | [![NPM version](https://img.shields.io/npm/v/{{{ name }}}.svg?style=flat)](https://npmjs.org/package/{{{ name }}}) 4 | [![NPM downloads](http://img.shields.io/npm/dm/{{{ name }}}.svg?style=flat)](https://npmjs.org/package/{{{ name }}}) 5 | 6 | {{{ description }}} 7 | 8 | ## Install 9 | 10 | ```bash 11 | # or yarn 12 | $ npm install 13 | ``` 14 | 15 | ```bash 16 | $ npm run build --watch 17 | $ npm run start 18 | ``` 19 | 20 | ## Usage 21 | 22 | Configure in `.umirc.js`, 23 | 24 | ```js 25 | export default { 26 | plugins: [ 27 | ['{{{ name }}}'], 28 | ], 29 | } 30 | ``` 31 | 32 | ## Options 33 | 34 | TODO 35 | 36 | ## LICENSE 37 | 38 | MIT 39 | -------------------------------------------------------------------------------- /packages/create-alita/templates/plugin/package.json.tpl: -------------------------------------------------------------------------------- 1 | { 2 | "name": "{{{ name }}}", 3 | "version": "0.0.1", 4 | "description": "{{{ description }}}", 5 | "main": "lib/index.js", 6 | "types": "lib/index.d.ts", 7 | "scripts": { 8 | "build": "father-build" 9 | }, 10 | "keywords": [], 11 | "repository": "{{{ org }}}/{{{ name }}}", 12 | "authors": { 13 | "name": "{{{ author }}}", 14 | "email": "{{{ mail }}}" 15 | }, 16 | "license": "MIT", 17 | "files": [ 18 | "lib" 19 | ], 20 | "devDependencies": { 21 | "@umijs/types": "{{{ version }}}", 22 | "father-build": "^1.20.0" 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /packages/create-alita/templates/plugin/src/index.ts.tpl: -------------------------------------------------------------------------------- 1 | import type { IApi } from '@umijs/types'; 2 | 3 | export default (api: IApi) => { 4 | // TODO: https://umijs.org/plugins/api 5 | }; 6 | -------------------------------------------------------------------------------- /packages/create-alita/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "outDir": "./dist", 5 | "rootDir": "./src" 6 | }, 7 | "include": ["src"] 8 | } 9 | -------------------------------------------------------------------------------- /packages/flow/src/components/Footer/index.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | /** 4 | * alita content 5 | * 6 | * ```typescript 7 | * 8 | *
9 | *
10 | * ``` 11 | */ 12 | const Footer: React.FC< 13 | React.DetailedHTMLProps, HTMLDivElement> 14 | > = ({ children, style, ...reset }) => { 15 | return ( 16 |
27 | {children} 28 |
29 | ); 30 | }; 31 | 32 | export default Footer; 33 | -------------------------------------------------------------------------------- /packages/flow/src/components/Header/index.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | /** 4 | * alita header 5 | * 6 | * ```typescript 7 | * 8 | *
9 | *
10 | * ``` 11 | */ 12 | const Header: React.FC< 13 | React.DetailedHTMLProps, HTMLDivElement> 14 | > = ({ children, style, ...reset }) => { 15 | return ( 16 |
27 | {children} 28 |
29 | ); 30 | }; 31 | 32 | export default Header; 33 | -------------------------------------------------------------------------------- /packages/flow/src/components/Show/index.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | interface ShowProps { 4 | when: boolean; 5 | fallback?: React.ReactElement; 6 | children: React.ReactElement; 7 | } 8 | 9 | /** 10 | * Conditionally render its children or an optional fallback component 11 | */ 12 | const Show: React.FC = (props) => { 13 | const { when, fallback = <>, children } = props; 14 | if (when) return children; 15 | return fallback; 16 | }; 17 | 18 | export default Show; 19 | -------------------------------------------------------------------------------- /packages/flow/src/index.ts: -------------------------------------------------------------------------------- 1 | export { default as Content } from './components/Content'; 2 | export { ErrorBoundary, withErrorBoundary } from './components/ErrorBoundary'; 3 | export { default as FillContainer } from './components/FillContainer'; 4 | export { default as FlexContent } from './components/FlexContent'; 5 | export { default as Footer } from './components/Footer'; 6 | export { default as For } from './components/For'; 7 | export { default as Header } from './components/Header'; 8 | export { default as Page } from './components/Page'; 9 | export { default as Show } from './components/Show'; 10 | export { default as ShrinkingModule } from './components/ShrinkingModule'; 11 | export { default as Switch, Match } from './components/Switch'; 12 | -------------------------------------------------------------------------------- /packages/flow/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "declaration": true, 4 | "declarationMap": true, 5 | "esModuleInterop": true, 6 | "module": "commonjs", 7 | "moduleResolution": "node", 8 | "noUnusedLocals": true, 9 | "noUnusedParameters": true, 10 | "strict": true, 11 | "skipLibCheck": true, 12 | "target": "ES5", 13 | "jsx": "react", 14 | "outDir": "./dist", 15 | "rootDir": "./src" 16 | }, 17 | "include": ["src"], 18 | "exclude": [ 19 | "**/node_modules", 20 | "**/examples", 21 | "**/dist", 22 | "**/fixtures", 23 | "**/*.test.ts" 24 | ] 25 | } 26 | -------------------------------------------------------------------------------- /packages/native/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .changelog 3 | .umi 4 | .umi-test 5 | .umi-production 6 | .DS_Store 7 | /lib 8 | dist 9 | -------------------------------------------------------------------------------- /packages/native/src/plugins.ts: -------------------------------------------------------------------------------- 1 | // embedded plugins 2 | const embeddedPlugins = [ 3 | '@capacitor/action-sheet', 4 | '@capacitor/app', 5 | '@capacitor/app-launcher', 6 | '@capacitor/browser', 7 | '@capacitor/camera', 8 | '@capacitor/clipboard', 9 | '@capacitor/device', 10 | '@capacitor/dialog', 11 | '@capacitor/filesystem', 12 | '@capacitor/geolocation', 13 | '@capacitor/keyboard', 14 | '@capacitor/local-notifications', 15 | '@capacitor/network', 16 | '@capacitor/push-notifications', 17 | '@capacitor/share', 18 | '@capacitor/status-bar', 19 | '@capacitor/storage', 20 | '@capacitor/toast', 21 | '@alitajs/fileviewer', 22 | '@alitajs/http', 23 | ]; 24 | 25 | export { embeddedPlugins }; 26 | -------------------------------------------------------------------------------- /packages/native/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "outDir": "./dist", 5 | "rootDir": "./src" 6 | }, 7 | "include": ["src"] 8 | } 9 | -------------------------------------------------------------------------------- /packages/plugin-azure/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "outDir": "./dist", 5 | "rootDir": "./src" 6 | }, 7 | "include": ["src"] 8 | } 9 | -------------------------------------------------------------------------------- /packages/plugin-extends-app/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # @alita/plugin-extends-app 2 | 3 | ## 3.0.2 4 | 5 | ### Patch Changes 6 | 7 | - [#669](https://github.com/alitajs/alita/pull/669) [`3c96755c64dda0ff4fbfe8607adeedfb2d16b419`](https://github.com/alitajs/alita/commit/3c96755c64dda0ff4fbfe8607adeedfb2d16b419) Thanks [@xiaohuoni](https://github.com/xiaohuoni)! - feat: add plugin extends app 8 | -------------------------------------------------------------------------------- /packages/plugin-extends-app/README.md: -------------------------------------------------------------------------------- 1 | # @alita/plugin-exclude-pages 2 | 3 | See our website [alitajs](https://alitajs.com) for more information. 4 | -------------------------------------------------------------------------------- /packages/plugin-extends-app/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "outDir": "./dist", 5 | "rootDir": "./src" 6 | }, 7 | "include": ["src"] 8 | } 9 | -------------------------------------------------------------------------------- /packages/plugin-lowcode/README.md: -------------------------------------------------------------------------------- 1 | # @alita/plugin-nocode 2 | 3 | 专项项目使用包,请勿在任何项目中使用 4 | 5 | -------------------------------------------------------------------------------- /packages/plugin-lowcode/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "outDir": "./dist", 5 | "rootDir": "./src" 6 | }, 7 | "include": ["src"] 8 | } 9 | -------------------------------------------------------------------------------- /packages/plugins/README.md: -------------------------------------------------------------------------------- 1 | # @alita/plugins 2 | 3 | See our website [alitajs](https://alitajs.com) for more information. -------------------------------------------------------------------------------- /packages/plugins/compiled/@alitajs/postcss-plugin-px2rem/package.json: -------------------------------------------------------------------------------- 1 | {"name":"@alitajs/postcss-plugin-px2rem","author":"pigcan ","license":"MIT"} 2 | -------------------------------------------------------------------------------- /packages/plugins/compiled/vconsole/LICENSE: -------------------------------------------------------------------------------- 1 | Tencent is pleased to support the open source community by making vConsole available. 2 | 3 | Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved. 4 | 5 | If you have downloaded a copy of the vConsole binary from Tencent, please note that the vConsole binary is licensed under the MIT License. 6 | 7 | If you have downloaded a copy of the vConsole source code from Tencent, please note that vConsole source code is licensed under the MIT License, except for the third-party components listed below which are subject to different license terms. Your integration of vConsole into your own projects may require compliance with the MIT License, as well as the other licenses applicable to the third-party components included within vConsole. 8 | 9 | A copy of the MIT License is included in this file. -------------------------------------------------------------------------------- /packages/plugins/compiled/vconsole/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vconsole", 3 | "author": "Tencent", 4 | "license": "MIT", 5 | "typings": "dist/vconsole.min.d.ts" 6 | } 7 | -------------------------------------------------------------------------------- /packages/plugins/src/analytics.ts: -------------------------------------------------------------------------------- 1 | import analytics from '@umijs/plugins/dist/analytics'; 2 | 3 | export default analytics; 4 | -------------------------------------------------------------------------------- /packages/plugins/src/classnames.ts: -------------------------------------------------------------------------------- 1 | import type { AlitaApi } from '@alita/types'; 2 | 3 | import { dirname } from 'path'; 4 | 5 | export default (api: AlitaApi) => { 6 | // only dev or build running 7 | if (!['dev', 'build', 'dev-config', 'preview', 'setup'].includes(api.name)) 8 | return; 9 | 10 | api.addExtraBabelPlugins(() => { 11 | return [require.resolve('@alita/babel-transform-jsx-class')]; 12 | }); 13 | api.modifyConfig((memo) => { 14 | memo.alias['babel-runtime-jsx-plus'] = dirname( 15 | require.resolve('babel-runtime-jsx-plus/package.json'), 16 | ); 17 | memo.alias['classnames'] = dirname( 18 | require.resolve('classnames/package.json'), 19 | ); 20 | return memo; 21 | }); 22 | }; 23 | -------------------------------------------------------------------------------- /packages/plugins/src/index.ts: -------------------------------------------------------------------------------- 1 | import type { AlitaApi } from '@alita/types'; 2 | import { logger } from '@umijs/utils'; 3 | 4 | export default (api: AlitaApi) => { 5 | api.onStart(() => { 6 | logger.event('alita plugins dev presets'); 7 | }); 8 | return { 9 | plugins: [ 10 | require.resolve('./aconsole'), 11 | require.resolve('./antdmobile'), 12 | require.resolve('./hd'), 13 | require.resolve('./keepalive'), 14 | require.resolve('./mainpath'), 15 | require.resolve('./request'), 16 | require.resolve('./mobile-layout'), 17 | require.resolve('./dva'), 18 | // require.resolve('@umijs/plugins/dist/dva'), 19 | require.resolve('@umijs/plugins/dist/model'), 20 | ], 21 | }; 22 | }; 23 | -------------------------------------------------------------------------------- /packages/plugins/src/max/initial-state.ts: -------------------------------------------------------------------------------- 1 | import type { AlitaApi } from '@alita/types'; 2 | import statePlugin from '@umijs/plugins/dist/initial-state'; 3 | import { logger } from '@umijs/utils'; 4 | 5 | export default (api: AlitaApi) => { 6 | if (!['dev', 'build', 'dev-config', 'preview', 'setup'].includes(api.name)) 7 | return; 8 | 9 | api.onStart(() => { 10 | logger.info('Using Initial State Plugin'); 11 | }); 12 | statePlugin(api); 13 | }; 14 | -------------------------------------------------------------------------------- /packages/plugins/src/max/locale.ts: -------------------------------------------------------------------------------- 1 | import type { AlitaApi } from '@alita/types'; 2 | import localePlugin from '@umijs/plugins/dist/locale'; 3 | import { logger } from '@umijs/utils'; 4 | 5 | export default (api: AlitaApi) => { 6 | api.onStart(() => { 7 | logger.info('Using Locale Plugin'); 8 | }); 9 | 10 | localePlugin(api); 11 | }; 12 | -------------------------------------------------------------------------------- /packages/plugins/src/model.ts: -------------------------------------------------------------------------------- 1 | import type { AlitaApi } from '@alita/types'; 2 | import modelPlugin from '@umijs/plugins/dist/model'; 3 | 4 | export default (api: AlitaApi) => { 5 | api.describe({ 6 | key: 'model', 7 | config: { 8 | schema(Joi) { 9 | return Joi.object({ 10 | extraModels: Joi.array().items(Joi.string()), 11 | }); 12 | }, 13 | }, 14 | // 默认开启 15 | // enableBy: api.EnableBy.config, 16 | }); 17 | // only dev or build running 18 | if (!['dev', 'build', 'dev-config', 'preview', 'setup'].includes(api.name)) 19 | return; 20 | 21 | // umi model 里面不注册 22 | api.describe = () => {}; 23 | // @ts-ignore 24 | modelPlugin(api); 25 | }; 26 | -------------------------------------------------------------------------------- /packages/plugins/src/moment.ts: -------------------------------------------------------------------------------- 1 | import type { AlitaApi } from '@alita/types'; 2 | import momentPlugin from '@umijs/plugins/dist/moment2dayjs'; 3 | 4 | export default (api: AlitaApi) => { 5 | // only build running 6 | if (!['build'].includes(api.name)) return; 7 | // @ts-ignore 8 | momentPlugin(api); 9 | }; 10 | -------------------------------------------------------------------------------- /packages/plugins/src/utils/astUtils.ts: -------------------------------------------------------------------------------- 1 | import * as Babel from '@umijs/bundler-utils/compiled/babel/core'; 2 | import * as t from '@umijs/bundler-utils/compiled/babel/types'; 3 | 4 | export function getIdentifierDeclaration(node: t.Node, path: Babel.NodePath) { 5 | if (t.isIdentifier(node) && path.scope.hasBinding(node.name)) { 6 | let bindingNode = path.scope.getBinding(node.name)!.path.node; 7 | if (t.isVariableDeclarator(bindingNode)) { 8 | bindingNode = bindingNode.init!; 9 | } 10 | return bindingNode; 11 | } 12 | return node; 13 | } 14 | -------------------------------------------------------------------------------- /packages/plugins/src/utils/getFile/fixtures/normal/a.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/packages/plugins/src/utils/getFile/fixtures/normal/a.js -------------------------------------------------------------------------------- /packages/plugins/src/utils/getFile/fixtures/normal/b.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/packages/plugins/src/utils/getFile/fixtures/normal/b.js -------------------------------------------------------------------------------- /packages/plugins/src/utils/getFile/fixtures/normal/b.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/packages/plugins/src/utils/getFile/fixtures/normal/b.ts -------------------------------------------------------------------------------- /packages/plugins/src/utils/getFile/fixtures/normal/c.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/packages/plugins/src/utils/getFile/fixtures/normal/c.css -------------------------------------------------------------------------------- /packages/plugins/src/utils/getFile/fixtures/normal/c.less: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/packages/plugins/src/utils/getFile/fixtures/normal/c.less -------------------------------------------------------------------------------- /packages/plugins/src/utils/getFile/fixtures/normal/d.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/packages/plugins/src/utils/getFile/fixtures/normal/d.css -------------------------------------------------------------------------------- /packages/plugins/src/utils/resetMainPath/resetMainPath.test.ts: -------------------------------------------------------------------------------- 1 | import resetMainPath from './resetMainPath'; 2 | 3 | test('resetMainPath', () => { 4 | const routes = [ 5 | { 6 | path: '/abc', 7 | }, 8 | { 9 | path: '/', 10 | }, 11 | { 12 | path: '/home', 13 | }, 14 | ] as any; 15 | const mainPath = '/home'; 16 | expect(resetMainPath(routes, mainPath)).toEqual([ 17 | { path: '/abc' }, 18 | { isResetMainEdit: true, path: '/index' }, 19 | { isResetMainEdit: true, path: '/' }, 20 | ]); 21 | }); 22 | -------------------------------------------------------------------------------- /packages/plugins/src/utils/resolveProjectDep.ts: -------------------------------------------------------------------------------- 1 | import { resolve } from '@umijs/utils'; 2 | import { dirname } from 'path'; 3 | 4 | export function resolveProjectDep(opts: { 5 | pkg: any; 6 | cwd: string; 7 | dep: string; 8 | }) { 9 | if ( 10 | opts.pkg.dependencies?.[opts.dep] || 11 | opts.pkg.devDependencies?.[opts.dep] 12 | ) { 13 | return dirname( 14 | resolve.sync(`${opts.dep}/package.json`, { 15 | basedir: opts.cwd, 16 | }), 17 | ); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /packages/plugins/src/utils/withTmpPath.ts: -------------------------------------------------------------------------------- 1 | import type { AlitaApi } from '@alita/types'; 2 | import { winPath } from '@umijs/utils'; 3 | 4 | import { join } from 'path'; 5 | 6 | export function withTmpPath(opts: { 7 | api: AlitaApi; 8 | path: string; 9 | noPluginDir?: boolean; 10 | }) { 11 | return winPath( 12 | join( 13 | opts.api.paths.absTmpPath, 14 | opts.api.plugin.key && !opts.noPluginDir 15 | ? `plugin-${opts.api.plugin.key}` 16 | : '', 17 | opts.path, 18 | ), 19 | ); 20 | } 21 | -------------------------------------------------------------------------------- /packages/plugins/templates/aconsole/runtime.tpl: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { _InspxContainer } from './inspx'; 3 | 4 | export function rootContainer(container) { 5 | return React.createElement(_InspxContainer, null, container); 6 | } 7 | -------------------------------------------------------------------------------- /packages/plugins/templates/alias/index.d.ts.tpl: -------------------------------------------------------------------------------- 1 | export * from '{{{ antdMobilePath }}}' -------------------------------------------------------------------------------- /packages/plugins/templates/alias/package.json.tpl: -------------------------------------------------------------------------------- 1 | { 2 | "name": "{{{ antdMobile }}}", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "", 6 | "types": "index.d.ts", 7 | "scripts": { 8 | "test": "echo \"Error: no test specified\" && exit 1" 9 | }, 10 | "keywords": [], 11 | "author": "", 12 | "license": "ISC" 13 | } 14 | -------------------------------------------------------------------------------- /packages/plugins/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "outDir": "./dist", 5 | "rootDir": "./src" 6 | }, 7 | "include": ["src"] 8 | } 9 | -------------------------------------------------------------------------------- /packages/request/README.md: -------------------------------------------------------------------------------- 1 | # @alita/request 2 | 3 | See our website [alitajs](https://alitajs.com) for more information. -------------------------------------------------------------------------------- /packages/request/src/index.test.ts: -------------------------------------------------------------------------------- 1 | import { getRequestConfig, setRequestConfig } from './index'; 2 | 3 | test('normal', () => { 4 | setRequestConfig({ hello: '123' }); 5 | expect(getRequestConfig()).toEqual({ hello: '123' }); 6 | }); 7 | -------------------------------------------------------------------------------- /packages/request/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "target": "ES5", 5 | "outDir": "./dist", 6 | "rootDir": "./src" 7 | }, 8 | "include": ["src"] 9 | } 10 | -------------------------------------------------------------------------------- /packages/types/README.md: -------------------------------------------------------------------------------- 1 | # @alita/types 2 | 3 | See our website [alitajs](https://alitajs.com) for more information. -------------------------------------------------------------------------------- /packages/types/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@alita/types", 3 | "version": "3.1.2", 4 | "description": "@alita/types", 5 | "main": "dist/index.js", 6 | "types": "dist/index.d.ts", 7 | "files": [ 8 | "dist" 9 | ], 10 | "scripts": { 11 | "build": "pnpm tsc", 12 | "build:deps": "umi-scripts bundleDeps", 13 | "dev": "pnpm build --watch" 14 | }, 15 | "repository": { 16 | "type": "git", 17 | "url": "https://github.com/alitajs/alita" 18 | }, 19 | "authors": [ 20 | "xiaohuoni (https://github.com/xiaohuoni)" 21 | ], 22 | "license": "MIT", 23 | "bugs": "https://github.com/alitajs/alita/issues", 24 | "homepage": "https://github.com/alitajs/alita/tree/master/packages/types#readme", 25 | "publishConfig": { 26 | "access": "public" 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /packages/types/src/index.ts: -------------------------------------------------------------------------------- 1 | import { IApi } from 'umi'; 2 | 3 | export type AlitaApi = IApi & {}; 4 | -------------------------------------------------------------------------------- /packages/types/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.base.json", 3 | "compilerOptions": { 4 | "outDir": "./dist", 5 | "rootDir": "./src" 6 | }, 7 | "include": ["src"] 8 | } 9 | -------------------------------------------------------------------------------- /plugin.ts: -------------------------------------------------------------------------------- 1 | import { copyFileSync, existsSync } from 'fs'; 2 | import { join } from 'path'; 3 | import { IApi } from 'umi'; 4 | 5 | export default (api: IApi) => { 6 | api.onBuildComplete(({ err }) => { 7 | //@ts-ignore 8 | if (!err && !existsSync(join(api.paths.absOutputPath!, '404.html'))) { 9 | // 如果没有 404 则复制一下 index 10 | setTimeout(() => { 11 | copyFileSync( 12 | join(api.paths.absOutputPath!, 'index.html'), 13 | join(api.paths.absOutputPath!, '404.html'), 14 | ); 15 | }, 500); 16 | } 17 | }); 18 | }; 19 | -------------------------------------------------------------------------------- /pnpm-workspace.yaml: -------------------------------------------------------------------------------- 1 | packages: 2 | - 'packages/*' 3 | - 'examples/*' 4 | - 'scripts' 5 | -------------------------------------------------------------------------------- /public/dingding.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/public/dingding.png -------------------------------------------------------------------------------- /public/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/public/logo.png -------------------------------------------------------------------------------- /public/wechat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alitajs/alita/4b25215e737d8e7dc2c373f9f737395c1b9a33f2/public/wechat.png -------------------------------------------------------------------------------- /scripts/.internal/constants.ts: -------------------------------------------------------------------------------- 1 | import { join } from 'path'; 2 | 3 | const ROOT = join(__dirname, '../../'); 4 | export const PATHS = { 5 | ROOT, 6 | PACKAGES: join(ROOT, './packages'), 7 | EXAMPLES: join(ROOT, './examples'), 8 | LERNA_CONFIG: join(ROOT, './lerna.json'), 9 | JEST_TURBO_CONFIG: join(ROOT, './jest.turbo.config.ts'), 10 | } as const; 11 | 12 | export const SCRIPTS = { 13 | BUNDLE_DEPS: 'umi-scripts bundleDeps', 14 | DEV: 'pnpm build --watch', 15 | BUILD: 'pnpm tsc', 16 | TEST_TURBO: 'umi-scripts jest-turbo', 17 | } as const; 18 | -------------------------------------------------------------------------------- /scripts/jest-turbo.ts: -------------------------------------------------------------------------------- 1 | import { PATHS } from './.internal/constants'; 2 | import { spawnSync } from './.internal/utils'; 3 | 4 | (async () => { 5 | spawnSync(`jest -c ${PATHS.JEST_TURBO_CONFIG}`, { cwd: process.cwd() }); 6 | })(); 7 | -------------------------------------------------------------------------------- /scripts/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "umi-scripts", 3 | "version": "1.0.0", 4 | "private": true, 5 | "bin": { 6 | "umi-scripts": "bin/umi-scripts.js" 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /scripts/setupWebStorm.ts: -------------------------------------------------------------------------------- 1 | import { PATHS } from './.internal/constants'; 2 | import { eachPkg, getPkgs, setExcludeFolder } from './.internal/utils'; 3 | 4 | const cwd = process.cwd(); 5 | eachPkg(getPkgs(), ({ name }) => { 6 | setExcludeFolder({ pkg: name, cwd }); 7 | }); 8 | 9 | eachPkg( 10 | getPkgs({ base: PATHS.EXAMPLES }), 11 | ({ name }) => { 12 | setExcludeFolder({ 13 | pkg: name, 14 | cwd, 15 | dirName: 'examples', 16 | folders: ['.mfsu', '.umi'], 17 | }); 18 | }, 19 | { 20 | base: PATHS.EXAMPLES, 21 | }, 22 | ); 23 | -------------------------------------------------------------------------------- /scripts/syncTnpm.ts: -------------------------------------------------------------------------------- 1 | import { logger } from '@umijs/utils'; 2 | import 'zx/globals'; 3 | import { PATHS } from './.internal/constants'; 4 | import { getPkgs } from './.internal/utils'; 5 | 6 | (async () => { 7 | const pkgs = getPkgs(); 8 | logger.info(`pkgs: ${pkgs.join(', ')}`); 9 | 10 | // sync tnpm 11 | logger.event('sync tnpm'); 12 | $.verbose = false; 13 | await Promise.all( 14 | pkgs.map(async (pkg) => { 15 | const { name } = require(path.join(PATHS.PACKAGES, pkg, 'package.json')); 16 | logger.info(`sync ${name}`); 17 | await $`tnpm sync ${name}`; 18 | }), 19 | ); 20 | $.verbose = true; 21 | })(); 22 | -------------------------------------------------------------------------------- /tsconfig.base.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "declaration": true, 4 | "declarationMap": true, 5 | "esModuleInterop": true, 6 | "module": "commonjs", 7 | "moduleResolution": "node", 8 | "noUnusedLocals": true, 9 | "noUnusedParameters": true, 10 | "strict": true, 11 | "skipLibCheck": true, 12 | "target": "esnext", 13 | "jsx": "react", 14 | "paths": { 15 | "alita": ["./packages/alita"] 16 | } 17 | }, 18 | "exclude": [ 19 | "**/node_modules", 20 | "**/examples", 21 | "**/dist", 22 | "**/fixtures", 23 | "**/*.test.ts" 24 | ] 25 | } 26 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.base.json" 3 | } 4 | -------------------------------------------------------------------------------- /turbo.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://turborepo.org/schema.json", 3 | "pipeline": { 4 | "build": { 5 | "dependsOn": ["^build"], 6 | "outputs": ["dist/**"] 7 | }, 8 | "build:extra": { 9 | "cache": false 10 | }, 11 | "build:client": { 12 | "cache": false 13 | }, 14 | "dev": { 15 | "cache": false 16 | }, 17 | "test": { 18 | "outputs": [".jest-cache/**"] 19 | }, 20 | "test:e2e": {} 21 | }, 22 | "globalDependencies": [ 23 | "tsconfig.base.json", 24 | "tsconfig.json", 25 | "jest.config.ts" 26 | ] 27 | } 28 | -------------------------------------------------------------------------------- /workflows/emoji-helper.yml: -------------------------------------------------------------------------------- 1 | name: Emoji Helper 2 | 3 | on: 4 | release: 5 | types: [published] 6 | 7 | jobs: 8 | emoji: 9 | runs-on: ubuntu-latest 10 | steps: 11 | - uses: actions-cool/emoji-helper@v1.0.0 12 | with: 13 | type: 'release' 14 | emoji: '+1, laugh, heart, hooray, rocket, eyes' 15 | --------------------------------------------------------------------------------