create-bubbles 0.1.18 → 0.1.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +406 -11
- package/package.json +3 -2
- package/template-nextjs-vinext-eslint/.dockerignore +3 -0
- package/template-nextjs-vinext-eslint/.vscode/settings.json +53 -0
- package/template-nextjs-vinext-eslint/Dockerfile +21 -0
- package/template-nextjs-vinext-eslint/README.md +100 -0
- package/template-nextjs-vinext-eslint/commitlint.config.js +1 -0
- package/template-nextjs-vinext-eslint/docker-compose.yaml +22 -0
- package/template-nextjs-vinext-eslint/eslint.config.js +20 -0
- package/template-nextjs-vinext-eslint/lefthook.yml +11 -0
- package/template-nextjs-vinext-eslint/next.config.ts +8 -0
- package/template-nextjs-vinext-eslint/nginx.conf +14 -0
- package/template-nextjs-vinext-eslint/package.json +50 -0
- package/template-nextjs-vinext-eslint/pnpm-workspace.yaml +7 -0
- package/template-nextjs-vinext-eslint/public/file.svg +1 -0
- package/template-nextjs-vinext-eslint/public/globe.svg +1 -0
- package/template-nextjs-vinext-eslint/public/logo-white.svg +128 -0
- package/template-nextjs-vinext-eslint/public/next.svg +1 -0
- package/template-nextjs-vinext-eslint/public/vercel.svg +1 -0
- package/template-nextjs-vinext-eslint/public/window.svg +1 -0
- package/template-nextjs-vinext-eslint/src/app/_components/Header/header.module.css +0 -0
- package/template-nextjs-vinext-eslint/src/app/_components/Header/header.tsx +7 -0
- package/template-nextjs-vinext-eslint/src/app/_components/Main/index.tsx +13 -0
- package/template-nextjs-vinext-eslint/src/app/antd-provider.tsx +30 -0
- package/template-nextjs-vinext-eslint/src/app/icon.svg +26 -0
- package/template-nextjs-vinext-eslint/src/app/layout.tsx +68 -0
- package/template-nextjs-vinext-eslint/src/app/page.module.css +141 -0
- package/template-nextjs-vinext-eslint/src/app/page.tsx +43 -0
- package/template-nextjs-vinext-eslint/src/app/uno-css.tsx +7 -0
- package/template-nextjs-vinext-eslint/src/assets/icon/logo-white.svg +128 -0
- package/template-nextjs-vinext-eslint/src/assets/icon/logo.svg +26 -0
- package/template-nextjs-vinext-eslint/src/assets/image/QR.png +0 -0
- package/template-nextjs-vinext-eslint/src/assets/image/banner_1.png +0 -0
- package/template-nextjs-vinext-eslint/src/assets/image/banner_2.png +0 -0
- package/template-nextjs-vinext-eslint/src/assets/image/banner_3.png +0 -0
- package/template-nextjs-vinext-eslint/src/assets/image/banner_4.png +0 -0
- package/template-nextjs-vinext-eslint/src/assets/image/banner_top.png +0 -0
- package/template-nextjs-vinext-eslint/src/assets/image/icon_title_left.png +0 -0
- package/template-nextjs-vinext-eslint/src/assets/image/icon_title_right.png +0 -0
- package/template-nextjs-vinext-eslint/src/assets/image/img.png +0 -0
- package/template-nextjs-vinext-eslint/src/assets/image/parteners/logo_COCT.png +0 -0
- package/template-nextjs-vinext-eslint/src/assets/image/parteners/logo_/344/270/207/347/247/221.png +0 -0
- package/template-nextjs-vinext-eslint/src/assets/image/parteners/logo_/344/270/255/345/205/264.png +0 -0
- package/template-nextjs-vinext-eslint/src/assets/image/parteners/logo_/344/270/255/345/206/266/345/273/272/345/267/245.png +0 -0
- package/template-nextjs-vinext-eslint/src/assets/image/parteners/logo_/344/270/255/345/233/275/344/270/255/351/223/201.png +0 -0
- package/template-nextjs-vinext-eslint/src/assets/image/parteners/logo_/344/270/255/345/233/275/344/272/224/345/206/266.png +0 -0
- package/template-nextjs-vinext-eslint/src/assets/image/parteners/logo_/344/270/255/345/233/275/344/272/244/351/200/232/345/273/272/350/256/276.png +0 -0
- package/template-nextjs-vinext-eslint/src/assets/image/parteners/logo_/344/270/255/345/233/275/345/273/272/344/270/232.png +0 -0
- package/template-nextjs-vinext-eslint/src/assets/image/parteners/logo_/344/270/255/345/233/275/345/273/272/347/255/221/347/247/221/345/255/246/351/231/242.png +0 -0
- package/template-nextjs-vinext-eslint/src/assets/image/parteners/logo_/344/270/255/345/233/275/347/224/265/345/273/272.png +0 -0
- package/template-nextjs-vinext-eslint/src/assets/image/parteners/logo_/344/270/255/345/233/275/351/223/201/345/273/272.png +0 -0
- package/template-nextjs-vinext-eslint/src/assets/image/parteners/logo_/345/256/234/351/200/232/344/270/226/347/272/252.png +0 -0
- package/template-nextjs-vinext-eslint/src/assets/image/parteners/logo_/346/225/260/347/273/264/347/251/272/351/227/264.png +0 -0
- package/template-nextjs-vinext-eslint/src/assets/image/parteners/logo_/346/226/260/346/230/212/350/276/260/345/273/272/350/256/276.png +0 -0
- package/template-nextjs-vinext-eslint/src/assets/image/parteners/logo_/346/236/227/345/220/214/346/243/252/345/233/275/351/231/205.png +0 -0
- package/template-nextjs-vinext-eslint/src/assets/image/parteners/logo_/346/270/235/351/232/206/351/233/206/345/233/242.png +0 -0
- package/template-nextjs-vinext-eslint/src/assets/image/parteners/logo_/347/273/264/345/241/224/347/247/221/346/212/200.png +0 -0
- package/template-nextjs-vinext-eslint/src/assets/image/parteners/logo_/350/205/276/350/256/257.png +0 -0
- package/template-nextjs-vinext-eslint/src/assets/image/parteners/logo_/350/265/233/350/277/252/344/277/241/346/201/257.png +0 -0
- package/template-nextjs-vinext-eslint/src/assets/image/parteners/logo_/351/207/215/345/272/206/344/272/244/351/200/232/345/244/247/345/255/246.png +0 -0
- package/template-nextjs-vinext-eslint/src/assets/image/parteners/logo_/351/207/215/345/272/206/344/272/244/351/200/232/350/201/214/344/270/232/345/255/246/351/231/242.png +0 -0
- package/template-nextjs-vinext-eslint/src/assets/image/parteners/logo_/351/207/215/345/272/206/345/244/247/345/255/246.png +0 -0
- package/template-nextjs-vinext-eslint/src/assets/image/parteners/logo_/351/207/215/345/272/206/345/267/245/345/225/206/350/201/214/344/270/232/345/255/246/351/231/242.png +0 -0
- package/template-nextjs-vinext-eslint/src/assets/image/parteners/logo_/351/207/215/345/272/206/345/267/245/347/250/213/350/201/214/344/270/232/346/212/200/346/234/257/345/255/246/351/231/242.png +0 -0
- package/template-nextjs-vinext-eslint/src/assets/image/parteners/logo_/351/207/215/345/272/206/345/273/272/345/267/245.png +0 -0
- package/template-nextjs-vinext-eslint/src/assets/image/parteners/logo_/351/230/277/351/207/214/344/272/221.png +0 -0
- package/template-nextjs-vinext-eslint/src/assets/image/parteners/logo_/351/231/206/345/206/233/345/206/233/345/214/273/345/244/247/345/255/246.png +0 -0
- package/template-nextjs-vinext-eslint/src/assets/image/parteners/logo_/351/276/231/346/271/226.png +0 -0
- package/template-nextjs-vinext-eslint/src/styles/globals.css +47 -0
- package/template-nextjs-vinext-eslint/src/types/vite-env.d.ts +18 -0
- package/template-nextjs-vinext-eslint/src/utils/env.ts +14 -0
- package/template-nextjs-vinext-eslint/src/utils/index.ts +0 -0
- package/template-nextjs-vinext-eslint/src/utils/request/core/index.ts +425 -0
- package/template-nextjs-vinext-eslint/src/utils/request/core/utils.ts +39 -0
- package/template-nextjs-vinext-eslint/src/utils/request/index.ts +48 -0
- package/template-nextjs-vinext-eslint/tsconfig.json +34 -0
- package/template-nextjs-vinext-eslint/uno.config.ts +8 -0
- package/template-nextjs-vinext-eslint/vite.config.ts +8 -0
- package/template-react-rsbuild-biome/.env +5 -0
- package/template-react-rsbuild-biome/.env.development +1 -0
- package/template-react-rsbuild-biome/.env.production +1 -0
- package/template-react-rsbuild-biome/.prettierignore +34 -0
- package/template-react-rsbuild-biome/.prettierrc +16 -0
- package/template-react-rsbuild-biome/.vscode/settings.json +10 -0
- package/template-react-rsbuild-biome/README.md +29 -0
- package/template-react-rsbuild-biome/biome.json +116 -0
- package/template-react-rsbuild-biome/commitlint.config.js +1 -0
- package/template-react-rsbuild-biome/index.html +7 -0
- package/template-react-rsbuild-biome/lefthook.yml +14 -0
- package/template-react-rsbuild-biome/package.json +42 -0
- package/template-react-rsbuild-biome/public/.gitkeep +0 -0
- package/template-react-rsbuild-biome/rsbuild.config.ts +44 -0
- package/template-react-rsbuild-biome/src/App.tsx +9 -0
- package/template-react-rsbuild-biome/src/assets/font/AlimamaShuHeiTi-Bold.ttf +0 -0
- package/template-react-rsbuild-biome/src/assets/icon/logo.svg +7 -0
- package/template-react-rsbuild-biome/src/components/Loading/PageLoading.tsx +11 -0
- package/template-react-rsbuild-biome/src/env.d.ts +1 -0
- package/template-react-rsbuild-biome/src/index.tsx +18 -0
- package/template-react-rsbuild-biome/src/layout/default/index.tsx +10 -0
- package/template-react-rsbuild-biome/src/pages/home/index.tsx +5 -0
- package/template-react-rsbuild-biome/src/router/index.tsx +38 -0
- package/template-react-rsbuild-biome/src/store/index.ts +0 -0
- package/template-react-rsbuild-biome/src/store/modules/user.ts +11 -0
- package/template-react-rsbuild-biome/src/styles/fonts.scss +4 -0
- package/template-react-rsbuild-biome/src/styles/index.scss +19 -0
- package/template-react-rsbuild-biome/src/styles/variables.scss +4 -0
- package/template-react-rsbuild-biome/src/types/auto-import.d.ts +49 -0
- package/template-react-rsbuild-biome/src/utils/env.ts +10 -0
- package/template-react-rsbuild-biome/src/utils/request/core/index.ts +425 -0
- package/template-react-rsbuild-biome/src/utils/request/core/utils.ts +39 -0
- package/template-react-rsbuild-biome/src/utils/request/index.ts +42 -0
- package/template-react-rsbuild-biome/tsconfig.json +35 -0
- package/template-react-rsbuild-biome/uno.config.ts +8 -0
- package/template-taro-react-oxc/.editorconfig +12 -0
- package/template-taro-react-oxc/.env +1 -0
- package/template-taro-react-oxc/.env.development +6 -0
- package/template-taro-react-oxc/.env.production +5 -0
- package/template-taro-react-oxc/.oxfmtrc.json +12 -0
- package/template-taro-react-oxc/.oxlintrc.json +9 -0
- package/template-taro-react-oxc/.vscode/settings.json +13 -0
- package/template-taro-react-oxc/babel.config.js +45 -0
- package/template-taro-react-oxc/commitlint.config.mjs +1 -0
- package/template-taro-react-oxc/config/dev.ts +10 -0
- package/template-taro-react-oxc/config/index.ts +172 -0
- package/template-taro-react-oxc/config/prod.ts +39 -0
- package/template-taro-react-oxc/config/release.ts +106 -0
- package/template-taro-react-oxc/key/.gitkeep +0 -0
- package/template-taro-react-oxc/lefthook.yaml +18 -0
- package/template-taro-react-oxc/package.json +118 -0
- package/template-taro-react-oxc/patches/@tarojs__plugin-mini-ci.patch +13 -0
- package/template-taro-react-oxc/pnpm-workspace.yaml +13 -0
- package/template-taro-react-oxc/postcss.config.js +6 -0
- package/template-taro-react-oxc/project.config.json +15 -0
- package/template-taro-react-oxc/src/app.config.ts +11 -0
- package/template-taro-react-oxc/src/app.ts +14 -0
- package/template-taro-react-oxc/src/index.html +17 -0
- package/template-taro-react-oxc/src/pages/index/index.config.ts +3 -0
- package/template-taro-react-oxc/src/pages/index/index.scss +0 -0
- package/template-taro-react-oxc/src/pages/index/index.tsx +44 -0
- package/template-taro-react-oxc/src/store/taroStorage.ts +7 -0
- package/template-taro-react-oxc/src/store/user.ts +13 -0
- package/template-taro-react-oxc/src/styles/index.css +1 -0
- package/template-taro-react-oxc/src/utils/env.ts +10 -0
- package/template-taro-react-oxc/src/utils/request/core/index.ts +425 -0
- package/template-taro-react-oxc/src/utils/request/core/utils.ts +39 -0
- package/template-taro-react-oxc/src/utils/request/index.ts +37 -0
- package/template-taro-react-oxc/stylelint.config.mjs +28 -0
- package/template-taro-react-oxc/tailwind.config.js +12 -0
- package/template-taro-react-oxc/tsconfig.json +28 -0
- package/template-taro-react-oxc/types/global.d.ts +29 -0
- package/template-taro-vue-eslint/.editorconfig +12 -0
- package/template-taro-vue-eslint/.env +3 -0
- package/template-taro-vue-eslint/.env.development +5 -0
- package/template-taro-vue-eslint/.env.production +5 -0
- package/template-taro-vue-eslint/.vscode/settings.json +57 -0
- package/template-taro-vue-eslint/babel.config.js +12 -0
- package/template-taro-vue-eslint/commitlint.config.mjs +1 -0
- package/template-taro-vue-eslint/config/dev.ts +27 -0
- package/template-taro-vue-eslint/config/index.ts +134 -0
- package/template-taro-vue-eslint/config/output-root.ts +11 -0
- package/template-taro-vue-eslint/config/prod.ts +39 -0
- package/template-taro-vue-eslint/config/release.ts +113 -0
- package/template-taro-vue-eslint/eslint.config.mjs +22 -0
- package/template-taro-vue-eslint/lefthook.yaml +13 -0
- package/template-taro-vue-eslint/package.json +115 -0
- package/template-taro-vue-eslint/patches/@tarojs__plugin-mini-ci.patch +13 -0
- package/template-taro-vue-eslint/pnpm-workspace.yaml +13 -0
- package/template-taro-vue-eslint/project.config.json +16 -0
- package/template-taro-vue-eslint/src/api/common/upload.ts +53 -0
- package/template-taro-vue-eslint/src/app.config.ts +19 -0
- package/template-taro-vue-eslint/src/app.ts +14 -0
- package/template-taro-vue-eslint/src/assets/image/.gitkeep +0 -0
- package/template-taro-vue-eslint/src/index.html +17 -0
- package/template-taro-vue-eslint/src/pages/example/upload/index.config.ts +3 -0
- package/template-taro-vue-eslint/src/pages/example/upload/index.module.scss +4 -0
- package/template-taro-vue-eslint/src/pages/example/upload/index.vue +71 -0
- package/template-taro-vue-eslint/src/pages/index/index.config.ts +3 -0
- package/template-taro-vue-eslint/src/pages/index/index.module.scss +4 -0
- package/template-taro-vue-eslint/src/pages/index/index.vue +77 -0
- package/template-taro-vue-eslint/src/store/index.ts +10 -0
- package/template-taro-vue-eslint/src/store/modules/user.ts +15 -0
- package/template-taro-vue-eslint/src/store/taroStorage.ts +7 -0
- package/template-taro-vue-eslint/src/styles/index.css +1 -0
- package/template-taro-vue-eslint/src/styles/nut-theme.css +4 -0
- package/template-taro-vue-eslint/src/utils/env.ts +13 -0
- package/template-taro-vue-eslint/src/utils/index.ts +40 -0
- package/template-taro-vue-eslint/src/utils/request/core/index.ts +425 -0
- package/template-taro-vue-eslint/src/utils/request/core/utils.ts +39 -0
- package/template-taro-vue-eslint/src/utils/request/index.ts +73 -0
- package/template-taro-vue-eslint/tsconfig.json +30 -0
- package/template-taro-vue-eslint/types/components.d.ts +16 -0
- package/template-taro-vue-eslint/types/global.d.ts +31 -0
- package/template-taro-vue-eslint/types/vue.d.ts +10 -0
- package/template-taro-vue-eslint/unocss.config.ts +42 -0
- package/template-vp-monorepo-react-nestjs/.oxfmtrc.jsonc +8 -0
- package/template-vp-monorepo-react-nestjs/.oxlintrc.jsonc +3 -0
- package/template-vp-monorepo-react-nestjs/.specs//351/234/200/346/261/202.md +5 -0
- package/template-vp-monorepo-react-nestjs/.vite-hooks/commit-msg +1 -0
- package/template-vp-monorepo-react-nestjs/.vite-hooks/pre-commit +1 -0
- package/template-vp-monorepo-react-nestjs/README.md +29 -0
- package/template-vp-monorepo-react-nestjs/apps/service/.oxlintrc.jsonc +3 -0
- package/template-vp-monorepo-react-nestjs/apps/web/.env +1 -0
- package/template-vp-monorepo-react-nestjs/apps/web/.oxlintrc.jsonc +4 -0
- package/template-vp-monorepo-react-nestjs/apps/web/index.html +13 -0
- package/template-vp-monorepo-react-nestjs/apps/web/package.json +39 -0
- package/template-vp-monorepo-react-nestjs/apps/web/public/favicon.svg +1 -0
- package/template-vp-monorepo-react-nestjs/apps/web/public/icons.svg +24 -0
- package/template-vp-monorepo-react-nestjs/apps/web/src/App.tsx +24 -0
- package/template-vp-monorepo-react-nestjs/apps/web/src/assets/hero.png +0 -0
- package/template-vp-monorepo-react-nestjs/apps/web/src/assets/react.svg +1 -0
- package/template-vp-monorepo-react-nestjs/apps/web/src/assets/vite.svg +1 -0
- package/template-vp-monorepo-react-nestjs/apps/web/src/components/Loading/PageLoading.tsx +11 -0
- package/template-vp-monorepo-react-nestjs/apps/web/src/main.tsx +5 -0
- package/template-vp-monorepo-react-nestjs/apps/web/src/pages/home/index.tsx +17 -0
- package/template-vp-monorepo-react-nestjs/apps/web/src/router/index.tsx +25 -0
- package/template-vp-monorepo-react-nestjs/apps/web/src/router/modules/.gitkeep +0 -0
- package/template-vp-monorepo-react-nestjs/apps/web/src/styles/index.css +7 -0
- package/template-vp-monorepo-react-nestjs/apps/web/src/types/auto-imports.d.ts +58 -0
- package/template-vp-monorepo-react-nestjs/apps/web/tsconfig.json +32 -0
- package/template-vp-monorepo-react-nestjs/apps/web/vite.config.ts +32 -0
- package/template-vp-monorepo-react-nestjs/commitlint.config.js +0 -0
- package/template-vp-monorepo-react-nestjs/package.json +20 -0
- package/template-vp-monorepo-react-nestjs/packages/utils/README.md +23 -0
- package/template-vp-monorepo-react-nestjs/packages/utils/package.json +39 -0
- package/template-vp-monorepo-react-nestjs/packages/utils/src/index.ts +3 -0
- package/template-vp-monorepo-react-nestjs/packages/utils/tests/index.test.ts +6 -0
- package/template-vp-monorepo-react-nestjs/packages/utils/tsconfig.json +20 -0
- package/template-vp-monorepo-react-nestjs/packages/utils/tsdown.config.ts +9 -0
- package/template-vp-monorepo-react-nestjs/packages/utils/vite.config.ts +7 -0
- package/template-vp-monorepo-react-nestjs/pnpm-workspace.yaml +23 -0
- package/template-vp-monorepo-react-nestjs/tsconfig.json +9 -0
- package/template-vp-monorepo-react-nestjs/vite.config.ts +8 -0
- package/template-vp-react/.env +1 -0
- package/template-vp-react/.oxfmtrc.jsonc +8 -0
- package/template-vp-react/.oxlintrc.jsonc +11 -0
- package/template-vp-react/.vite-hooks/commit-msg +1 -0
- package/template-vp-react/.vite-hooks/pre-commit +1 -0
- package/template-vp-react/.vscode/extensions.json +3 -0
- package/template-vp-react/.vscode/settings.json +11 -0
- package/template-vp-react/commitlint.config.js +0 -0
- package/template-vp-react/index.html +13 -0
- package/template-vp-react/package.json +44 -0
- package/template-vp-react/public/favicon.svg +1 -0
- package/template-vp-react/public/icons.svg +24 -0
- package/template-vp-react/src/App.tsx +24 -0
- package/template-vp-react/src/assets/hero.png +0 -0
- package/template-vp-react/src/assets/react.svg +1 -0
- package/template-vp-react/src/assets/vite.svg +1 -0
- package/template-vp-react/src/components/Loading/PageLoading.tsx +11 -0
- package/template-vp-react/src/main.tsx +5 -0
- package/template-vp-react/src/pages/home/index.tsx +17 -0
- package/template-vp-react/src/router/index.tsx +25 -0
- package/template-vp-react/src/router/modules/.gitkeep +0 -0
- package/template-vp-react/src/styles/index.css +7 -0
- package/template-vp-react/src/types/auto-imports.d.ts +58 -0
- package/template-vp-react/src/utils/env/index.ts +6 -0
- package/template-vp-react/src/utils/request/core/index.ts +420 -0
- package/template-vp-react/src/utils/request/core/utils.ts +39 -0
- package/template-vp-react/src/utils/request/index.ts +48 -0
- package/template-vp-react/tsconfig.json +32 -0
- package/template-vp-react/vite.config.ts +35 -0
- package/template-vp-react-shadcn/.agents/skills/alova-client-usage/README.md +28 -0
- package/template-vp-react-shadcn/.agents/skills/alova-client-usage/SKILL.md +249 -0
- package/template-vp-react-shadcn/.agents/skills/alova-client-usage/references/SETUP.md +146 -0
- package/template-vp-react-shadcn/.agents/skills/shadcn/SKILL.md +260 -0
- package/template-vp-react-shadcn/.agents/skills/shadcn/agents/openai.yml +5 -0
- package/template-vp-react-shadcn/.agents/skills/shadcn/assets/shadcn-small.png +0 -0
- package/template-vp-react-shadcn/.agents/skills/shadcn/assets/shadcn.png +0 -0
- package/template-vp-react-shadcn/.agents/skills/shadcn/cli.md +276 -0
- package/template-vp-react-shadcn/.agents/skills/shadcn/customization.md +209 -0
- package/template-vp-react-shadcn/.agents/skills/shadcn/evals/evals.json +47 -0
- package/template-vp-react-shadcn/.agents/skills/shadcn/mcp.md +94 -0
- package/template-vp-react-shadcn/.agents/skills/shadcn/rules/base-vs-radix.md +306 -0
- package/template-vp-react-shadcn/.agents/skills/shadcn/rules/composition.md +195 -0
- package/template-vp-react-shadcn/.agents/skills/shadcn/rules/forms.md +192 -0
- package/template-vp-react-shadcn/.agents/skills/shadcn/rules/icons.md +101 -0
- package/template-vp-react-shadcn/.agents/skills/shadcn/rules/styling.md +162 -0
- package/template-vp-react-shadcn/.agents/skills/vite-plus/README.md +75 -0
- package/template-vp-react-shadcn/.agents/skills/vite-plus/SKILL.md +322 -0
- package/template-vp-react-shadcn/.agents/skills/vite-plus/evals.json +182 -0
- package/template-vp-react-shadcn/.agents/skills/vite-plus/references/config.md +162 -0
- package/template-vp-react-shadcn/.agents/skills/vite-plus/references/env-management.md +76 -0
- package/template-vp-react-shadcn/.agents/skills/vite-plus/references/task-runner.md +152 -0
- package/template-vp-react-shadcn/.agents/skills/vite-plus/sources.yaml +142 -0
- package/template-vp-react-shadcn/.env +1 -0
- package/template-vp-react-shadcn/.oxfmtrc.jsonc +8 -0
- package/template-vp-react-shadcn/.oxlintrc.jsonc +3 -0
- package/template-vp-react-shadcn/.vite-hooks/commit-msg +1 -0
- package/template-vp-react-shadcn/.vite-hooks/pre-commit +1 -0
- package/template-vp-react-shadcn/.vscode/extensions.json +3 -0
- package/template-vp-react-shadcn/.vscode/settings.json +12 -0
- package/template-vp-react-shadcn/agents.md +44 -0
- package/template-vp-react-shadcn/commitlint.config.js +1 -0
- package/template-vp-react-shadcn/components.json +25 -0
- package/template-vp-react-shadcn/index.html +13 -0
- package/template-vp-react-shadcn/package.json +56 -0
- package/template-vp-react-shadcn/public/favicon.svg +1 -0
- package/template-vp-react-shadcn/public/icons.svg +24 -0
- package/template-vp-react-shadcn/skills-lock.json +11 -0
- package/template-vp-react-shadcn/src/App.tsx +24 -0
- package/template-vp-react-shadcn/src/api/.gitkeep +0 -0
- package/template-vp-react-shadcn/src/assets/hero.png +0 -0
- package/template-vp-react-shadcn/src/assets/react.svg +1 -0
- package/template-vp-react-shadcn/src/assets/vite.svg +1 -0
- package/template-vp-react-shadcn/src/components/Loading/PageLoading.tsx +11 -0
- package/template-vp-react-shadcn/src/components/Player/VideoJS/index.tsx +163 -0
- package/template-vp-react-shadcn/src/components/Player/index.ts +7 -0
- package/template-vp-react-shadcn/src/components/ui/button.tsx +67 -0
- package/template-vp-react-shadcn/src/components/ui/sonner.tsx +43 -0
- package/template-vp-react-shadcn/src/components/ui/spinner.tsx +17 -0
- package/template-vp-react-shadcn/src/hooks/.gitkeep +0 -0
- package/template-vp-react-shadcn/src/lib/utils.ts +6 -0
- package/template-vp-react-shadcn/src/main.tsx +5 -0
- package/template-vp-react-shadcn/src/pages/home/index.tsx +96 -0
- package/template-vp-react-shadcn/src/router/index.tsx +25 -0
- package/template-vp-react-shadcn/src/router/modules/.gitkeep +0 -0
- package/template-vp-react-shadcn/src/store/.gitkeep +0 -0
- package/template-vp-react-shadcn/src/styles/index.css +16 -0
- package/template-vp-react-shadcn/src/styles/shadcn.css +127 -0
- package/template-vp-react-shadcn/src/types/auto-imports.d.ts +58 -0
- package/template-vp-react-shadcn/src/utils/env/index.tsx +6 -0
- package/template-vp-react-shadcn/src/utils/request/alova-core/index.ts +425 -0
- package/template-vp-react-shadcn/src/utils/request/alova-core/utils.ts +39 -0
- package/template-vp-react-shadcn/src/utils/request/index.ts +48 -0
- package/template-vp-react-shadcn/src/utils/request/readme.md +176 -0
- package/template-vp-react-shadcn/tsconfig.json +32 -0
- package/template-vp-react-shadcn/vite.config.ts +35 -0
- package/template-vue-vite-eslint/.env +6 -0
- package/template-vue-vite-eslint/.env.development +2 -0
- package/template-vue-vite-eslint/.env.production +1 -0
- package/template-vue-vite-eslint/README.md +3 -0
- package/template-vue-vite-eslint/commitlint.config.js +1 -0
- package/template-vue-vite-eslint/eslint.config.js +69 -0
- package/template-vue-vite-eslint/index.html +13 -0
- package/template-vue-vite-eslint/lefthook.yml +11 -0
- package/template-vue-vite-eslint/package.json +56 -0
- package/template-vue-vite-eslint/public/vite.svg +1 -0
- package/template-vue-vite-eslint/src/App.vue +19 -0
- package/template-vue-vite-eslint/src/api/index.ts +12 -0
- package/template-vue-vite-eslint/src/assets/icon/computer-data.svg +3 -0
- package/template-vue-vite-eslint/src/assets/icon/cpu.svg +3 -0
- package/template-vue-vite-eslint/src/assets/icon/data-search.svg +3 -0
- package/template-vue-vite-eslint/src/assets/icon/home.svg +3 -0
- package/template-vue-vite-eslint/src/assets/icon/knowledge-graph.svg +3 -0
- package/template-vue-vite-eslint/src/assets/icon/logo.svg +1 -0
- package/template-vue-vite-eslint/src/assets/icon/robot.svg +3 -0
- package/template-vue-vite-eslint/src/assets/image/.gitkeep +0 -0
- package/template-vue-vite-eslint/src/components/Icon/svg-icon.vue +29 -0
- package/template-vue-vite-eslint/src/hooks/chart/lib.ts +57 -0
- package/template-vue-vite-eslint/src/hooks/chart/useEcharts.ts +65 -0
- package/template-vue-vite-eslint/src/layout/default/header/index.vue +12 -0
- package/template-vue-vite-eslint/src/layout/default/index.vue +55 -0
- package/template-vue-vite-eslint/src/main.ts +16 -0
- package/template-vue-vite-eslint/src/router/guard/index.ts +7 -0
- package/template-vue-vite-eslint/src/router/guard/permissionGuard.ts +13 -0
- package/template-vue-vite-eslint/src/router/index.ts +18 -0
- package/template-vue-vite-eslint/src/router/interface.ts +9 -0
- package/template-vue-vite-eslint/src/router/modules/example.ts +21 -0
- package/template-vue-vite-eslint/src/router/modules/index.ts +36 -0
- package/template-vue-vite-eslint/src/store/index.ts +11 -0
- package/template-vue-vite-eslint/src/store/modules/user.ts +20 -0
- package/template-vue-vite-eslint/src/styles/font.scss +0 -0
- package/template-vue-vite-eslint/src/styles/index.scss +29 -0
- package/template-vue-vite-eslint/src/styles/variables.scss +3 -0
- package/template-vue-vite-eslint/src/types/auto-import.d.ts +78 -0
- package/template-vue-vite-eslint/src/types/components.d.ts +18 -0
- package/template-vue-vite-eslint/src/types/vite-env.d.ts +15 -0
- package/template-vue-vite-eslint/src/utils/env.ts +11 -0
- package/template-vue-vite-eslint/src/utils/request/core/index.ts +425 -0
- package/template-vue-vite-eslint/src/utils/request/core/utils.ts +39 -0
- package/template-vue-vite-eslint/src/utils/request/index.ts +42 -0
- package/template-vue-vite-eslint/src/views/example/echart/config.ts +1794 -0
- package/template-vue-vite-eslint/src/views/example/echart/index.vue +22 -0
- package/template-vue-vite-eslint/src/views/example/h-full.vue +24 -0
- package/template-vue-vite-eslint/src/views/example/tree-chart.vue +94 -0
- package/template-vue-vite-eslint/src/views/home/index.vue +25 -0
- package/template-vue-vite-eslint/src/views/login/index.vue +9 -0
- package/template-vue-vite-eslint/tsconfig.json +36 -0
- package/template-vue-vite-eslint/uno.config.ts +21 -0
- package/template-vue-vite-eslint/vite.config.ts +60 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
/* prettier-ignore */
|
|
3
|
+
// @ts-nocheck
|
|
4
|
+
// noinspection JSUnusedGlobalSymbols
|
|
5
|
+
// Generated by unplugin-auto-import
|
|
6
|
+
// biome-ignore lint: disable
|
|
7
|
+
export {}
|
|
8
|
+
declare global {
|
|
9
|
+
const Activity: typeof import('react').Activity
|
|
10
|
+
const Fragment: typeof import('react').Fragment
|
|
11
|
+
const Suspense: typeof import('react').Suspense
|
|
12
|
+
const cache: typeof import('react').cache
|
|
13
|
+
const cacheSignal: typeof import('react').cacheSignal
|
|
14
|
+
const createContext: typeof import('react').createContext
|
|
15
|
+
const createPortal: typeof import('react-dom').createPortal
|
|
16
|
+
const createRef: typeof import('react').createRef
|
|
17
|
+
const flushSync: typeof import('react-dom').flushSync
|
|
18
|
+
const forwardRef: typeof import('react').forwardRef
|
|
19
|
+
const lazy: typeof import('react').lazy
|
|
20
|
+
const memo: typeof import('react').memo
|
|
21
|
+
const preconnect: typeof import('react-dom').preconnect
|
|
22
|
+
const prefetchDNS: typeof import('react-dom').prefetchDNS
|
|
23
|
+
const preinit: typeof import('react-dom').preinit
|
|
24
|
+
const preinitModule: typeof import('react-dom').preinitModule
|
|
25
|
+
const preload: typeof import('react-dom').preload
|
|
26
|
+
const preloadModule: typeof import('react-dom').preloadModule
|
|
27
|
+
const startTransition: typeof import('react').startTransition
|
|
28
|
+
const use: typeof import('react').use
|
|
29
|
+
const useActionState: typeof import('react').useActionState
|
|
30
|
+
const useCallback: typeof import('react').useCallback
|
|
31
|
+
const useContext: typeof import('react').useContext
|
|
32
|
+
const useDebugValue: typeof import('react').useDebugValue
|
|
33
|
+
const useDeferredValue: typeof import('react').useDeferredValue
|
|
34
|
+
const useEffect: typeof import('react').useEffect
|
|
35
|
+
const useEffectEvent: typeof import('react').useEffectEvent
|
|
36
|
+
const useFormStatus: typeof import('react-dom').useFormStatus
|
|
37
|
+
const useHref: typeof import('react-router').useHref
|
|
38
|
+
const useId: typeof import('react').useId
|
|
39
|
+
const useImperativeHandle: typeof import('react').useImperativeHandle
|
|
40
|
+
const useInRouterContext: typeof import('react-router').useInRouterContext
|
|
41
|
+
const useInsertionEffect: typeof import('react').useInsertionEffect
|
|
42
|
+
const useLayoutEffect: typeof import('react').useLayoutEffect
|
|
43
|
+
const useLocation: typeof import('react-router').useLocation
|
|
44
|
+
const useMemo: typeof import('react').useMemo
|
|
45
|
+
const useNavigate: typeof import('react-router').useNavigate
|
|
46
|
+
const useNavigationType: typeof import('react-router').useNavigationType
|
|
47
|
+
const useOptimistic: typeof import('react').useOptimistic
|
|
48
|
+
const useOutlet: typeof import('react-router').useOutlet
|
|
49
|
+
const useOutletContext: typeof import('react-router').useOutletContext
|
|
50
|
+
const useParams: typeof import('react-router').useParams
|
|
51
|
+
const useReducer: typeof import('react').useReducer
|
|
52
|
+
const useRef: typeof import('react').useRef
|
|
53
|
+
const useResolvedPath: typeof import('react-router').useResolvedPath
|
|
54
|
+
const useRoutes: typeof import('react-router').useRoutes
|
|
55
|
+
const useState: typeof import('react').useState
|
|
56
|
+
const useSyncExternalStore: typeof import('react').useSyncExternalStore
|
|
57
|
+
const useTransition: typeof import('react').useTransition
|
|
58
|
+
}
|
|
@@ -0,0 +1,420 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
AlovaGlobalCacheAdapter,
|
|
3
|
+
AlovaOptions,
|
|
4
|
+
AlovaRequestAdapter,
|
|
5
|
+
GlobalCacheConfig,
|
|
6
|
+
StatesExport,
|
|
7
|
+
StatesHook,
|
|
8
|
+
} from 'alova'
|
|
9
|
+
import { createAlova } from 'alova'
|
|
10
|
+
import type { FetchRequestInit } from 'alova/fetch'
|
|
11
|
+
import adapterFetch from 'alova/fetch'
|
|
12
|
+
import { deepMergeObject, isPlainObject, isReadableStream, tryParseJsonString } from './utils'
|
|
13
|
+
|
|
14
|
+
type MaybePromise<T> = T | Promise<T>
|
|
15
|
+
type HeaderValue =
|
|
16
|
+
| string
|
|
17
|
+
| number
|
|
18
|
+
| boolean
|
|
19
|
+
| null
|
|
20
|
+
| undefined
|
|
21
|
+
| (() => MaybePromise<string | number | boolean | null | undefined>)
|
|
22
|
+
type StatusMatcher<RE> = number | number[] | ((status: number, response: RE) => boolean)
|
|
23
|
+
type CodeMatcher = Array<number | string>
|
|
24
|
+
|
|
25
|
+
export interface StatusMap<RE = unknown> {
|
|
26
|
+
success?: StatusMatcher<RE>
|
|
27
|
+
unAuthorized?: StatusMatcher<RE>
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface CodeMap {
|
|
31
|
+
success?: CodeMatcher
|
|
32
|
+
unAuthorized?: CodeMatcher
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface RequestMeta {
|
|
36
|
+
isWrapped?: boolean
|
|
37
|
+
isTransformResponse?: boolean
|
|
38
|
+
isShowSuccessMessage?: boolean
|
|
39
|
+
isShowErrorMessage?: boolean
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface BaseRequestOption<
|
|
43
|
+
RC extends object = FetchRequestInit,
|
|
44
|
+
RE = Response,
|
|
45
|
+
RH = Headers,
|
|
46
|
+
SE extends StatesExport<any> = StatesExport<any>,
|
|
47
|
+
> extends RequestMeta {
|
|
48
|
+
baseUrl?: string
|
|
49
|
+
timeout?: number
|
|
50
|
+
commonHeaders?: () => Record<string, HeaderValue>
|
|
51
|
+
statusMap?: StatusMap<RE>
|
|
52
|
+
codeMap?: CodeMap
|
|
53
|
+
responseCodeKey?: string
|
|
54
|
+
responseDataKey?: string
|
|
55
|
+
responseMessageKey?: string
|
|
56
|
+
cacheFor?: GlobalCacheConfig<any> | null
|
|
57
|
+
cacheLogger?: boolean
|
|
58
|
+
statesHook?: StatesHook<SE>
|
|
59
|
+
successDefaultMessage?: string
|
|
60
|
+
errorDefaultMessage?: string
|
|
61
|
+
successMessageFunc?: (message: string) => void
|
|
62
|
+
errorMessageFunc?: (message: string) => void
|
|
63
|
+
unAuthorizedResponseFunc?: () => void
|
|
64
|
+
requestAdapter?: AlovaRequestAdapter<RC, RE, RH>
|
|
65
|
+
l1Cache?: AlovaGlobalCacheAdapter
|
|
66
|
+
l2Cache?: AlovaGlobalCacheAdapter
|
|
67
|
+
storageAdapter?: AlovaGlobalCacheAdapter
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export type baseRequestOption<
|
|
71
|
+
RC extends object = FetchRequestInit,
|
|
72
|
+
RE = Response,
|
|
73
|
+
RH = Headers,
|
|
74
|
+
SE extends StatesExport<any> = StatesExport<any>,
|
|
75
|
+
> = BaseRequestOption<RC, RE, RH, SE>
|
|
76
|
+
|
|
77
|
+
export type RequestOption<
|
|
78
|
+
RC extends object = FetchRequestInit,
|
|
79
|
+
RE = Response,
|
|
80
|
+
RH = Headers,
|
|
81
|
+
SE extends StatesExport<any> = StatesExport<any>,
|
|
82
|
+
> = BaseRequestOption<RC, RE, RH, SE>
|
|
83
|
+
|
|
84
|
+
type RequestAlovaGenerics<RC extends object, RE, RH, SE extends StatesExport<any>> = {
|
|
85
|
+
Responded: unknown
|
|
86
|
+
Transformed: unknown
|
|
87
|
+
RequestConfig: RC
|
|
88
|
+
Response: RE
|
|
89
|
+
ResponseHeader: RH
|
|
90
|
+
L1Cache: AlovaGlobalCacheAdapter
|
|
91
|
+
L2Cache: AlovaGlobalCacheAdapter
|
|
92
|
+
StatesExport: SE
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
type ResolvedRequestOption<RC extends object, RE, RH, SE extends StatesExport<any>> = Required<
|
|
96
|
+
Pick<
|
|
97
|
+
BaseRequestOption<RC, RE, RH, SE>,
|
|
98
|
+
| 'baseUrl'
|
|
99
|
+
| 'statusMap'
|
|
100
|
+
| 'codeMap'
|
|
101
|
+
| 'responseCodeKey'
|
|
102
|
+
| 'responseDataKey'
|
|
103
|
+
| 'responseMessageKey'
|
|
104
|
+
| 'isWrapped'
|
|
105
|
+
| 'isTransformResponse'
|
|
106
|
+
| 'isShowSuccessMessage'
|
|
107
|
+
| 'successDefaultMessage'
|
|
108
|
+
| 'isShowErrorMessage'
|
|
109
|
+
| 'errorDefaultMessage'
|
|
110
|
+
| 'cacheLogger'
|
|
111
|
+
>
|
|
112
|
+
> &
|
|
113
|
+
BaseRequestOption<RC, RE, RH, SE>
|
|
114
|
+
|
|
115
|
+
const DEFAULT_SUCCESS_MESSAGE = '操作成功'
|
|
116
|
+
const DEFAULT_ERROR_MESSAGE = '服务异常'
|
|
117
|
+
|
|
118
|
+
const defaultRequestOption: BaseRequestOption<any, any, any, any> = {
|
|
119
|
+
baseUrl: '/',
|
|
120
|
+
timeout: undefined,
|
|
121
|
+
statusMap: {
|
|
122
|
+
success: 200,
|
|
123
|
+
unAuthorized: 401,
|
|
124
|
+
},
|
|
125
|
+
codeMap: {
|
|
126
|
+
success: [200],
|
|
127
|
+
unAuthorized: [401],
|
|
128
|
+
},
|
|
129
|
+
responseCodeKey: 'code',
|
|
130
|
+
responseDataKey: 'data',
|
|
131
|
+
responseMessageKey: 'message',
|
|
132
|
+
isWrapped: true,
|
|
133
|
+
isTransformResponse: true,
|
|
134
|
+
isShowSuccessMessage: false,
|
|
135
|
+
successDefaultMessage: DEFAULT_SUCCESS_MESSAGE,
|
|
136
|
+
isShowErrorMessage: true,
|
|
137
|
+
errorDefaultMessage: DEFAULT_ERROR_MESSAGE,
|
|
138
|
+
cacheFor: null,
|
|
139
|
+
cacheLogger: true,
|
|
140
|
+
requestAdapter: adapterFetch() as AlovaRequestAdapter<any, any, any>,
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
function getMethodMeta(method: unknown): RequestMeta {
|
|
144
|
+
const methodRecord = method as { meta?: RequestMeta; config?: { meta?: RequestMeta } } | undefined
|
|
145
|
+
return methodRecord?.config?.meta ?? methodRecord?.meta ?? {}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
function getMetaFlag(meta: RequestMeta, key: keyof RequestMeta, fallback: boolean): boolean {
|
|
149
|
+
const value = meta[key]
|
|
150
|
+
return typeof value === 'boolean' ? value : fallback
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
function isMatchedStatus<RE>(
|
|
154
|
+
status: number,
|
|
155
|
+
matcher: StatusMatcher<RE> | undefined,
|
|
156
|
+
response: RE,
|
|
157
|
+
): boolean {
|
|
158
|
+
if (matcher === undefined) return status >= 200 && status < 300
|
|
159
|
+
|
|
160
|
+
if (typeof matcher === 'function') return matcher(status, response)
|
|
161
|
+
|
|
162
|
+
return Array.isArray(matcher) ? matcher.includes(status) : matcher === status
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
function isMatchedCode(code: unknown, matcher: CodeMatcher | undefined): boolean {
|
|
166
|
+
if (!matcher?.length) return true
|
|
167
|
+
|
|
168
|
+
return matcher.some((item) => String(item) === String(code))
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
function getResponseStatus(response: unknown): number {
|
|
172
|
+
const responseRecord = response as { status?: unknown; statusCode?: unknown }
|
|
173
|
+
const status = responseRecord.statusCode ?? responseRecord.status
|
|
174
|
+
return typeof status === 'number' ? status : Number(status)
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
function getResponseMessage(data: unknown, messageKey: string, defaultMessage: string): string {
|
|
178
|
+
if (!isPlainObject(data)) return defaultMessage
|
|
179
|
+
|
|
180
|
+
const message = data[messageKey] ?? data.message ?? data.msg
|
|
181
|
+
if (typeof message === 'string') return message || defaultMessage
|
|
182
|
+
if (typeof message === 'number') return String(message)
|
|
183
|
+
|
|
184
|
+
return defaultMessage
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
function getResponseField(data: unknown, key: string): unknown {
|
|
188
|
+
return isPlainObject(data) ? data[key] : undefined
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
async function parseFetchResponse(response: {
|
|
192
|
+
status?: number
|
|
193
|
+
body?: unknown
|
|
194
|
+
headers?: Headers | Record<string, unknown>
|
|
195
|
+
clone?: () => Response
|
|
196
|
+
json?: () => Promise<unknown>
|
|
197
|
+
text?: () => Promise<string>
|
|
198
|
+
}): Promise<unknown> {
|
|
199
|
+
if (response.status === 204) return undefined
|
|
200
|
+
|
|
201
|
+
const reader = typeof response.clone === 'function' ? response.clone() : response
|
|
202
|
+
const contentType = getHeaderValue(response.headers, 'content-type')
|
|
203
|
+
|
|
204
|
+
if (contentType.includes('application/json') && typeof reader.json === 'function')
|
|
205
|
+
return reader.json()
|
|
206
|
+
|
|
207
|
+
if (contentType.startsWith('text/') && typeof reader.text === 'function')
|
|
208
|
+
return tryParseJsonString(await reader.text())
|
|
209
|
+
|
|
210
|
+
if (typeof reader.json === 'function') {
|
|
211
|
+
try {
|
|
212
|
+
return await reader.json()
|
|
213
|
+
} catch {
|
|
214
|
+
// Fall through to text parsing.
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
if (typeof reader.text === 'function') return tryParseJsonString(await reader.text())
|
|
219
|
+
|
|
220
|
+
return undefined
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
function getHeaderValue(
|
|
224
|
+
headers: Headers | Record<string, unknown> | undefined,
|
|
225
|
+
key: string,
|
|
226
|
+
): string {
|
|
227
|
+
if (!headers) return ''
|
|
228
|
+
|
|
229
|
+
if (typeof Headers !== 'undefined' && headers instanceof Headers) return headers.get(key) ?? ''
|
|
230
|
+
|
|
231
|
+
const headerRecord = headers as Record<string, unknown>
|
|
232
|
+
const value =
|
|
233
|
+
headerRecord[key] ?? headerRecord[key.toLowerCase()] ?? headerRecord[key.toUpperCase()]
|
|
234
|
+
return typeof value === 'string' ? value : ''
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
async function getResponseData(response: unknown): Promise<unknown> {
|
|
238
|
+
const responseRecord = response as {
|
|
239
|
+
body?: unknown
|
|
240
|
+
data?: unknown
|
|
241
|
+
json?: () => Promise<unknown>
|
|
242
|
+
text?: () => Promise<string>
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
if ('data' in responseRecord && !isReadableStream(responseRecord.body))
|
|
246
|
+
return tryParseJsonString(responseRecord.data)
|
|
247
|
+
|
|
248
|
+
if (
|
|
249
|
+
isReadableStream(responseRecord.body) ||
|
|
250
|
+
typeof responseRecord.json === 'function' ||
|
|
251
|
+
typeof responseRecord.text === 'function'
|
|
252
|
+
) {
|
|
253
|
+
return parseFetchResponse(responseRecord)
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
return response
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
async function resolveHeaderValue(value: HeaderValue): Promise<string | undefined> {
|
|
260
|
+
const resolved = typeof value === 'function' ? await value() : value
|
|
261
|
+
if (resolved === null || resolved === undefined) return undefined
|
|
262
|
+
return String(resolved)
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
function setHeader(target: unknown, key: string, value: string): void {
|
|
266
|
+
if (typeof Headers !== 'undefined' && target instanceof Headers) {
|
|
267
|
+
target.set(key, value)
|
|
268
|
+
return
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
if (Array.isArray(target)) {
|
|
272
|
+
target.push([key, value])
|
|
273
|
+
return
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
;(target as Record<string, string>)[key] = value
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
function resolveConfig<RC extends object, RE, RH, SE extends StatesExport<any>>(
|
|
280
|
+
option: BaseRequestOption<RC, RE, RH, SE>,
|
|
281
|
+
): ResolvedRequestOption<RC, RE, RH, SE> {
|
|
282
|
+
return deepMergeObject(defaultRequestOption, option) as ResolvedRequestOption<RC, RE, RH, SE>
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
export function createInstance<
|
|
286
|
+
RC extends object = FetchRequestInit,
|
|
287
|
+
RE = Response,
|
|
288
|
+
RH = Headers,
|
|
289
|
+
SE extends StatesExport<any> = StatesExport<any>,
|
|
290
|
+
>(option: RequestOption<RC, RE, RH, SE> = {}) {
|
|
291
|
+
const config = resolveConfig(option)
|
|
292
|
+
|
|
293
|
+
const alovaOptions: AlovaOptions<RequestAlovaGenerics<RC, RE, RH, SE>> = {
|
|
294
|
+
baseURL: config.baseUrl,
|
|
295
|
+
timeout: config.timeout,
|
|
296
|
+
cacheFor: config.cacheFor as GlobalCacheConfig<any>,
|
|
297
|
+
cacheLogger: config.cacheLogger,
|
|
298
|
+
statesHook: config.statesHook,
|
|
299
|
+
requestAdapter: config.requestAdapter!,
|
|
300
|
+
l1Cache: config.l1Cache,
|
|
301
|
+
l2Cache: config.l2Cache ?? config.storageAdapter,
|
|
302
|
+
beforeRequest: async (method) => {
|
|
303
|
+
const methodConfig = method.config as { headers?: unknown }
|
|
304
|
+
const headers = methodConfig.headers ?? {}
|
|
305
|
+
methodConfig.headers = headers
|
|
306
|
+
|
|
307
|
+
for (const [key, value] of Object.entries(config.commonHeaders?.() ?? {})) {
|
|
308
|
+
const resolvedValue = await resolveHeaderValue(value)
|
|
309
|
+
if (resolvedValue !== undefined) setHeader(headers, key, resolvedValue)
|
|
310
|
+
}
|
|
311
|
+
},
|
|
312
|
+
responded: {
|
|
313
|
+
onSuccess: async (response, method) => {
|
|
314
|
+
const meta = getMethodMeta(method)
|
|
315
|
+
const shouldTransform = getMetaFlag(meta, 'isTransformResponse', config.isTransformResponse)
|
|
316
|
+
const showSuccess = getMetaFlag(meta, 'isShowSuccessMessage', config.isShowSuccessMessage)
|
|
317
|
+
const showError = getMetaFlag(meta, 'isShowErrorMessage', config.isShowErrorMessage)
|
|
318
|
+
const isWrapped = getMetaFlag(meta, 'isWrapped', config.isWrapped)
|
|
319
|
+
|
|
320
|
+
if (!shouldTransform) return response
|
|
321
|
+
|
|
322
|
+
const status = getResponseStatus(response)
|
|
323
|
+
const data = await getResponseData(response)
|
|
324
|
+
|
|
325
|
+
if (!isMatchedStatus(status, config.statusMap.success, response)) {
|
|
326
|
+
if (isMatchedStatus(status, config.statusMap.unAuthorized, response))
|
|
327
|
+
config.unAuthorizedResponseFunc?.()
|
|
328
|
+
|
|
329
|
+
if (showError) {
|
|
330
|
+
config.errorMessageFunc?.(
|
|
331
|
+
getResponseMessage(data, config.responseMessageKey, config.errorDefaultMessage),
|
|
332
|
+
)
|
|
333
|
+
}
|
|
334
|
+
return Promise.reject(response)
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
if (!isWrapped) {
|
|
338
|
+
if (showSuccess) config.successMessageFunc?.(config.successDefaultMessage)
|
|
339
|
+
return data
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
const code = getResponseField(data, config.responseCodeKey)
|
|
343
|
+
const responseData = getResponseField(data, config.responseDataKey)
|
|
344
|
+
const responseMessage = getResponseMessage(
|
|
345
|
+
data,
|
|
346
|
+
config.responseMessageKey,
|
|
347
|
+
config.successDefaultMessage,
|
|
348
|
+
)
|
|
349
|
+
|
|
350
|
+
if (!isMatchedCode(code, config.codeMap.success)) {
|
|
351
|
+
if (isMatchedCode(code, config.codeMap.unAuthorized)) config.unAuthorizedResponseFunc?.()
|
|
352
|
+
|
|
353
|
+
if (showError) {
|
|
354
|
+
config.errorMessageFunc?.(
|
|
355
|
+
getResponseMessage(data, config.responseMessageKey, config.errorDefaultMessage),
|
|
356
|
+
)
|
|
357
|
+
}
|
|
358
|
+
return Promise.reject(response)
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
if (showSuccess) config.successMessageFunc?.(responseMessage)
|
|
362
|
+
|
|
363
|
+
return responseData
|
|
364
|
+
},
|
|
365
|
+
onError: (error, method) => {
|
|
366
|
+
const meta = getMethodMeta(method)
|
|
367
|
+
const showError = getMetaFlag(meta, 'isShowErrorMessage', config.isShowErrorMessage)
|
|
368
|
+
|
|
369
|
+
if (showError) {
|
|
370
|
+
config.errorMessageFunc?.(
|
|
371
|
+
error instanceof Error ? error.message : config.errorDefaultMessage,
|
|
372
|
+
)
|
|
373
|
+
}
|
|
374
|
+
return Promise.reject(error)
|
|
375
|
+
},
|
|
376
|
+
},
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
return createAlova(alovaOptions)
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
export type RequestInstance<
|
|
383
|
+
RC extends object = FetchRequestInit,
|
|
384
|
+
RE = Response,
|
|
385
|
+
RH = Headers,
|
|
386
|
+
SE extends StatesExport<any> = StatesExport<any>,
|
|
387
|
+
> = ReturnType<typeof createInstance<RC, RE, RH, SE>>
|
|
388
|
+
|
|
389
|
+
export type DualCallInstance<
|
|
390
|
+
RC extends object = FetchRequestInit,
|
|
391
|
+
RE = Response,
|
|
392
|
+
RH = Headers,
|
|
393
|
+
SE extends StatesExport<any> = StatesExport<any>,
|
|
394
|
+
> = RequestInstance<RC, RE, RH, SE> &
|
|
395
|
+
((option?: RequestOption<RC, RE, RH, SE>) => RequestInstance<RC, RE, RH, SE>)
|
|
396
|
+
|
|
397
|
+
export function createDualCallInstance<
|
|
398
|
+
RC extends object = FetchRequestInit,
|
|
399
|
+
RE = Response,
|
|
400
|
+
RH = Headers,
|
|
401
|
+
SE extends StatesExport<any> = StatesExport<any>,
|
|
402
|
+
>(baseConfig: BaseRequestOption<RC, RE, RH, SE>): DualCallInstance<RC, RE, RH, SE> {
|
|
403
|
+
const defaultInstance = createInstance(baseConfig)
|
|
404
|
+
const dualInstance = ((option?: RequestOption<RC, RE, RH, SE>) => {
|
|
405
|
+
if (!option) return defaultInstance
|
|
406
|
+
return createInstance(deepMergeObject(baseConfig, option))
|
|
407
|
+
}) as DualCallInstance<RC, RE, RH, SE>
|
|
408
|
+
|
|
409
|
+
Object.assign(dualInstance, defaultInstance)
|
|
410
|
+
dualInstance.Get = defaultInstance.Get.bind(defaultInstance)
|
|
411
|
+
dualInstance.Post = defaultInstance.Post.bind(defaultInstance)
|
|
412
|
+
dualInstance.Put = defaultInstance.Put.bind(defaultInstance)
|
|
413
|
+
dualInstance.Delete = defaultInstance.Delete.bind(defaultInstance)
|
|
414
|
+
dualInstance.Patch = defaultInstance.Patch.bind(defaultInstance)
|
|
415
|
+
dualInstance.Head = defaultInstance.Head.bind(defaultInstance)
|
|
416
|
+
dualInstance.Options = defaultInstance.Options.bind(defaultInstance)
|
|
417
|
+
dualInstance.Request = defaultInstance.Request.bind(defaultInstance)
|
|
418
|
+
|
|
419
|
+
return dualInstance
|
|
420
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export function deepMergeObject<T = any>(source: T, target: Partial<T>): T {
|
|
2
|
+
const merge = (src: any, tgt: any): any => {
|
|
3
|
+
if (!isPlainObject(src) || !isPlainObject(tgt)) return tgt === undefined ? src : tgt
|
|
4
|
+
|
|
5
|
+
const result = { ...src }
|
|
6
|
+
for (const key of Object.keys(tgt)) {
|
|
7
|
+
const targetValue = tgt[key]
|
|
8
|
+
result[key] = isPlainObject(targetValue) ? merge(result[key], targetValue) : targetValue
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
return result
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
return merge(source, target)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function isPlainObject(data: unknown): data is Record<string, any> {
|
|
18
|
+
return Object.prototype.toString.call(data) === '[object Object]'
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function isReadableStream(data: unknown): boolean {
|
|
22
|
+
if (typeof ReadableStream === 'undefined') return false
|
|
23
|
+
return data instanceof ReadableStream
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function tryParseJsonString(data: unknown): unknown {
|
|
27
|
+
if (typeof data !== 'string') return data
|
|
28
|
+
|
|
29
|
+
const value = data.trim()
|
|
30
|
+
if (!value) return data
|
|
31
|
+
|
|
32
|
+
if (!value.startsWith('{') && !value.startsWith('[')) return data
|
|
33
|
+
|
|
34
|
+
try {
|
|
35
|
+
return JSON.parse(value)
|
|
36
|
+
} catch {
|
|
37
|
+
return data
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { axiosRequestAdapter } from '@alova/adapter-axios'
|
|
2
|
+
import reactHook from 'alova/react'
|
|
3
|
+
import { message } from 'antd'
|
|
4
|
+
import { navigator } from '@/router'
|
|
5
|
+
import { envVariables } from '@/utils/env'
|
|
6
|
+
import { createDualCallInstance } from './core'
|
|
7
|
+
|
|
8
|
+
function normalizeBaseUrl(apiAffix?: string) {
|
|
9
|
+
if (!apiAffix) return '/'
|
|
10
|
+
if (/^https?:\/\//.test(apiAffix) || apiAffix.startsWith('/')) {
|
|
11
|
+
return apiAffix
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
return `/${apiAffix}`
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function getBaseConfig(): Parameters<typeof createDualCallInstance>[0] {
|
|
18
|
+
return {
|
|
19
|
+
baseUrl: normalizeBaseUrl(envVariables.API_AFFIX),
|
|
20
|
+
statusMap: {
|
|
21
|
+
success: [200, 201, 204],
|
|
22
|
+
unAuthorized: 401,
|
|
23
|
+
},
|
|
24
|
+
codeMap: {
|
|
25
|
+
success: [200],
|
|
26
|
+
unAuthorized: [401],
|
|
27
|
+
},
|
|
28
|
+
responseDataKey: 'data',
|
|
29
|
+
responseMessageKey: 'msg',
|
|
30
|
+
commonHeaders: () => ({}),
|
|
31
|
+
successMessageFunc: (msg) => {
|
|
32
|
+
message.success(msg)
|
|
33
|
+
},
|
|
34
|
+
errorMessageFunc: (msg) => {
|
|
35
|
+
message.error(msg)
|
|
36
|
+
},
|
|
37
|
+
unAuthorizedResponseFunc: () => {
|
|
38
|
+
navigator('/login')
|
|
39
|
+
message.error('登录过期或未登录')
|
|
40
|
+
},
|
|
41
|
+
statesHook: reactHook,
|
|
42
|
+
requestAdapter: axiosRequestAdapter(),
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const alovaRequest = createDualCallInstance(getBaseConfig())
|
|
47
|
+
|
|
48
|
+
export default alovaRequest
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2023",
|
|
4
|
+
"useDefineForClassFields": true,
|
|
5
|
+
"module": "ESNext",
|
|
6
|
+
"lib": ["ES2023", "DOM", "DOM.Iterable"],
|
|
7
|
+
"types": ["vite/client"],
|
|
8
|
+
"skipLibCheck": true,
|
|
9
|
+
|
|
10
|
+
/* Bundler mode */
|
|
11
|
+
"moduleResolution": "bundler",
|
|
12
|
+
"allowImportingTsExtensions": true,
|
|
13
|
+
"verbatimModuleSyntax": true,
|
|
14
|
+
"moduleDetection": "force",
|
|
15
|
+
"noEmit": true,
|
|
16
|
+
"jsx": "react-jsx",
|
|
17
|
+
|
|
18
|
+
/* Linting */
|
|
19
|
+
"strict": true,
|
|
20
|
+
"noUnusedLocals": true,
|
|
21
|
+
"noUnusedParameters": true,
|
|
22
|
+
"erasableSyntaxOnly": true,
|
|
23
|
+
"noFallthroughCasesInSwitch": true,
|
|
24
|
+
"noUncheckedSideEffectImports": true,
|
|
25
|
+
|
|
26
|
+
"baseUrl": ".",
|
|
27
|
+
"paths": {
|
|
28
|
+
"@/*": ["src/*"]
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"include": ["src"]
|
|
32
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import path from 'path'
|
|
2
|
+
|
|
3
|
+
import tailwindcss from '@tailwindcss/vite'
|
|
4
|
+
import react from '@vitejs/plugin-react'
|
|
5
|
+
import AutoImport from 'unplugin-auto-import/vite'
|
|
6
|
+
import { defineConfig, loadEnv } from 'vite-plus'
|
|
7
|
+
|
|
8
|
+
export default defineConfig(({ mode }) => {
|
|
9
|
+
const root = process.cwd()
|
|
10
|
+
const env = loadEnv(mode, root)
|
|
11
|
+
const { VITE_PORT } = env
|
|
12
|
+
|
|
13
|
+
return {
|
|
14
|
+
resolve: {
|
|
15
|
+
alias: {
|
|
16
|
+
'@': path.resolve(__dirname, 'src'),
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
server: {
|
|
20
|
+
port: Number(VITE_PORT),
|
|
21
|
+
host: '0.0.0.0',
|
|
22
|
+
},
|
|
23
|
+
plugins: [
|
|
24
|
+
react(),
|
|
25
|
+
AutoImport({
|
|
26
|
+
imports: ['react', 'react-router', 'react-dom'],
|
|
27
|
+
dts: './src/types/auto-imports.d.ts',
|
|
28
|
+
}),
|
|
29
|
+
tailwindcss(),
|
|
30
|
+
],
|
|
31
|
+
staged: {
|
|
32
|
+
'*': 'vp check --fix',
|
|
33
|
+
},
|
|
34
|
+
}
|
|
35
|
+
})
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Alova Client-Side Skill
|
|
2
|
+
|
|
3
|
+
Best practices guide for [alova v3](https://alova.js.org/) in browser/client-side/SSR applications.
|
|
4
|
+
|
|
5
|
+
> For server-side (Node/Bun/Deno), see `alova-server-usage` skill.
|
|
6
|
+
|
|
7
|
+
## Supported Frameworks
|
|
8
|
+
|
|
9
|
+
Vue3, Vue2, Nuxt, React, Next.js, React-Native, Expo, Uniapp, Taro, Svelte, SvelteKit, Solid
|
|
10
|
+
|
|
11
|
+
## Trigger Scenarios
|
|
12
|
+
|
|
13
|
+
Invoke this skill when working with:
|
|
14
|
+
|
|
15
|
+
- API requests and data fetching
|
|
16
|
+
- alova client setup and initialization
|
|
17
|
+
- Cross-component data refresh (`actionDelegationMiddleware` + `accessAction`)
|
|
18
|
+
- Request state management and caching
|
|
19
|
+
- Business scenarios: paginated lists, form submission, file upload, SSE, etc.
|
|
20
|
+
|
|
21
|
+
## Documentation Structure
|
|
22
|
+
|
|
23
|
+
- **SKILL.md** — Quick-reference API index, read this first
|
|
24
|
+
- **references/SETUP.md** — Installation and initialization guide
|
|
25
|
+
|
|
26
|
+
## Usage
|
|
27
|
+
|
|
28
|
+
For specific API questions, the skill fetches official docs on demand to ensure accuracy.
|