From c266c9e95b9056beb8f2cd5816190ebd7496f534 Mon Sep 17 00:00:00 2001 From: Timi Date: Thu, 2 Apr 2026 16:52:48 +0800 Subject: [PATCH] fix import path --- .gitignore | 17 ++-- examples/Root.vue | 15 ++-- examples/main.ts | 5 +- package.json | 8 +- pnpm-lock.yaml | 43 ++++++---- src/api/ArticleAPI.ts | 3 +- src/api/BaseAPI.ts | 16 ++++ src/api/CommentAPI.ts | 3 +- src/api/CommonAPI.ts | 4 +- src/api/DeveloperAPI.ts | 3 +- src/api/UserAPI.ts | 6 +- src/api/index.ts | 5 ++ src/assets/style/timi-web.less | 8 +- .../background-effect/flower-fall/index.ts | 2 +- .../background-effect/flower-fall/index.vue | 4 +- src/components/captcha/index.ts | 2 +- src/components/captcha/index.vue | 2 +- src/components/copyright/index.ts | 2 +- src/components/empty-tips/index.ts | 2 +- src/components/icon/index.ts | 2 +- src/components/icon/index.vue | 2 +- src/components/loading/index.ts | 2 +- src/components/loading/index.vue | 2 +- src/components/markdown-editor/index.ts | 2 +- src/components/markdown-editor/index.vue | 3 +- src/components/markdown-view/index.ts | 2 +- src/components/markdown-view/index.vue | 2 +- src/components/markdown-view/style.less | 2 +- src/components/popup/index.ts | 2 +- src/components/user-level/index.ts | 2 +- src/index.ts | 83 ++----------------- src/store/device.ts | 2 +- src/store/index.ts | 2 + src/store/user.ts | 4 +- src/types/Article.ts | 3 +- src/{types.ts => types/index.ts} | 12 ++- src/utils/Markdown.ts | 6 +- src/utils/Network.ts | 6 +- src/utils/SettingMapper.ts | 24 +++++- src/utils/Toolkit.ts | 16 +--- src/utils/index.ts | 22 +++++ tsconfig.json | 3 - tsconfig.node.json | 2 +- vite.config.ts | 16 ---- 44 files changed, 180 insertions(+), 194 deletions(-) create mode 100644 src/api/BaseAPI.ts create mode 100644 src/api/index.ts create mode 100644 src/store/index.ts rename src/{types.ts => types/index.ts} (71%) create mode 100644 src/utils/index.ts diff --git a/.gitignore b/.gitignore index e56de4d..e000ab1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,11 @@ +/.npmrc +/.eslintrc-auto-import.json +/components.d.ts +/examples/auto-imports.d.ts +/CLAUDE.md +/AGENTS.md +/.claude + # Logs logs *.log @@ -22,12 +30,3 @@ dist-ssr *.njsproj *.sln *.sw? - -/.eslintrc-auto-import.json -/components.d.ts -/examples/auto-imports.d.ts - -/CLAUDE.md -/AGENTS.md -/.claude - diff --git a/examples/Root.vue b/examples/Root.vue index ba8a45b..17ac0b8 100644 --- a/examples/Root.vue +++ b/examples/Root.vue @@ -1,21 +1,18 @@ diff --git a/examples/main.ts b/examples/main.ts index b032158..0044d81 100644 --- a/examples/main.ts +++ b/examples/main.ts @@ -1,10 +1,7 @@ import { createApp } from "vue"; import Root from "./Root.vue"; -import TimiWebUI, { axios, VPopup } from "timi-web"; // 本地开发 - -axios.defaults.baseURL = "http://localhost:8091"; +import { VPopup } from "timi-web"; // 本地开发 const app = createApp(Root); -app.use(TimiWebUI); app.directive("popup", VPopup); app.mount("#root"); diff --git a/package.json b/package.json index 44a80f4..cf1a4a0 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,11 @@ "dev": "vite", "dev:doc": "pnpm run -C docs dev", "build": "vue-tsc --noEmit && vite build", - "build:doc": "pnpm run -C docs build" + "build:doc": "pnpm run -C docs build", + "pub": "pnpm run build && npm publish --registry=https://nexus.imyeyu.com/repository/npm-timi/" + }, + "publishConfig": { + "registry": "https://nexus.imyeyu.com/repository/npm-timi/" }, "files": [ "dist/**", @@ -32,7 +36,7 @@ "node": ">=16.0.0" }, "dependencies": { - "axios": "1.12.0", + "axios": "1.13.5", "less": "4.5.1", "marked": "^17.0.1", "marked-gfm-heading-id": "^4.1.3", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b6f5b56..ea8accd 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -9,8 +9,8 @@ importers: .: dependencies: axios: - specifier: 1.12.0 - version: 1.12.0 + specifier: 1.13.5 + version: 1.13.5 less: specifier: 4.5.1 version: 4.5.1 @@ -539,66 +539,79 @@ packages: resolution: {integrity: sha512-Rn3n+FUk2J5VWx+ywrG/HGPTD9jXNbicRtTM11e/uorplArnXZYsVifnPPqNNP5BsO3roI4n8332ukpY/zN7rQ==} cpu: [arm] os: [linux] + libc: [glibc] '@rollup/rollup-linux-arm-musleabihf@4.55.1': resolution: {integrity: sha512-grPNWydeKtc1aEdrJDWk4opD7nFtQbMmV7769hiAaYyUKCT1faPRm2av8CX1YJsZ4TLAZcg9gTR1KvEzoLjXkg==} cpu: [arm] os: [linux] + libc: [musl] '@rollup/rollup-linux-arm64-gnu@4.55.1': resolution: {integrity: sha512-a59mwd1k6x8tXKcUxSyISiquLwB5pX+fJW9TkWU46lCqD/GRDe9uDN31jrMmVP3feI3mhAdvcCClhV8V5MhJFQ==} cpu: [arm64] os: [linux] + libc: [glibc] '@rollup/rollup-linux-arm64-musl@4.55.1': resolution: {integrity: sha512-puS1MEgWX5GsHSoiAsF0TYrpomdvkaXm0CofIMG5uVkP6IBV+ZO9xhC5YEN49nsgYo1DuuMquF9+7EDBVYu4uA==} cpu: [arm64] os: [linux] + libc: [musl] '@rollup/rollup-linux-loong64-gnu@4.55.1': resolution: {integrity: sha512-r3Wv40in+lTsULSb6nnoudVbARdOwb2u5fpeoOAZjFLznp6tDU8kd+GTHmJoqZ9lt6/Sys33KdIHUaQihFcu7g==} cpu: [loong64] os: [linux] + libc: [glibc] '@rollup/rollup-linux-loong64-musl@4.55.1': resolution: {integrity: sha512-MR8c0+UxAlB22Fq4R+aQSPBayvYa3+9DrwG/i1TKQXFYEaoW3B5b/rkSRIypcZDdWjWnpcvxbNaAJDcSbJU3Lw==} cpu: [loong64] os: [linux] + libc: [musl] '@rollup/rollup-linux-ppc64-gnu@4.55.1': resolution: {integrity: sha512-3KhoECe1BRlSYpMTeVrD4sh2Pw2xgt4jzNSZIIPLFEsnQn9gAnZagW9+VqDqAHgm1Xc77LzJOo2LdigS5qZ+gw==} cpu: [ppc64] os: [linux] + libc: [glibc] '@rollup/rollup-linux-ppc64-musl@4.55.1': resolution: {integrity: sha512-ziR1OuZx0vdYZZ30vueNZTg73alF59DicYrPViG0NEgDVN8/Jl87zkAPu4u6VjZST2llgEUjaiNl9JM6HH1Vdw==} cpu: [ppc64] os: [linux] + libc: [musl] '@rollup/rollup-linux-riscv64-gnu@4.55.1': resolution: {integrity: sha512-uW0Y12ih2XJRERZ4jAfKamTyIHVMPQnTZcQjme2HMVDAHY4amf5u414OqNYC+x+LzRdRcnIG1YodLrrtA8xsxw==} cpu: [riscv64] os: [linux] + libc: [glibc] '@rollup/rollup-linux-riscv64-musl@4.55.1': resolution: {integrity: sha512-u9yZ0jUkOED1BFrqu3BwMQoixvGHGZ+JhJNkNKY/hyoEgOwlqKb62qu+7UjbPSHYjiVy8kKJHvXKv5coH4wDeg==} cpu: [riscv64] os: [linux] + libc: [musl] '@rollup/rollup-linux-s390x-gnu@4.55.1': resolution: {integrity: sha512-/0PenBCmqM4ZUd0190j7J0UsQ/1nsi735iPRakO8iPciE7BQ495Y6msPzaOmvx0/pn+eJVVlZrNrSh4WSYLxNg==} cpu: [s390x] os: [linux] + libc: [glibc] '@rollup/rollup-linux-x64-gnu@4.55.1': resolution: {integrity: sha512-a8G4wiQxQG2BAvo+gU6XrReRRqj+pLS2NGXKm8io19goR+K8lw269eTrPkSdDTALwMmJp4th2Uh0D8J9bEV1vg==} cpu: [x64] os: [linux] + libc: [glibc] '@rollup/rollup-linux-x64-musl@4.55.1': resolution: {integrity: sha512-bD+zjpFrMpP/hqkfEcnjXWHMw5BIghGisOKPj+2NaNDuVT+8Ds4mPf3XcPHuat1tz89WRL+1wbcxKY3WSbiT7w==} cpu: [x64] os: [linux] + libc: [musl] '@rollup/rollup-openbsd-x64@4.55.1': resolution: {integrity: sha512-eLXw0dOiqE4QmvikfQ6yjgkg/xDM+MdU9YJuP4ySTibXU0oAvnEWXt7UDJmD4UkYialMfOGFPJnIHSe/kdzPxg==} @@ -888,8 +901,8 @@ packages: asynckit@0.4.0: resolution: {integrity: sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==} - axios@1.12.0: - resolution: {integrity: sha512-oXTDccv8PcfjZmPGlWsPSwtOJCZ/b6W5jAMCNcfwJbCzDckwG0jrYJFaWH1yvivfCXjVzV/SPDEhMB3Q+DSurg==} + axios@1.13.5: + resolution: {integrity: sha512-cz4ur7Vb0xS4/KUN0tPWe44eqxrIu31me+fbang3ijiNscE129POzipJJA6zniq2C/Z6sJCjMimjS8Lc/GAs8Q==} babel-plugin-prismjs@2.1.0: resolution: {integrity: sha512-ehzSKYfeAz4U78zi/sfwsjDPlq0LvDKxNefcZTJ/iKBu+plsHsLqZhUeGf1+82LAcA35UZGbU6ksEx2Utphc/g==} @@ -1218,8 +1231,8 @@ packages: flatted@3.3.1: resolution: {integrity: sha512-X8cqMLLie7KsNUDSdzeN8FYK9rEt4Dt67OsG/DNGnYTSDBG4uFAJFBnUeiV+zCVAvwFy56IjM9sH51jVaEhNxw==} - follow-redirects@1.15.6: - resolution: {integrity: sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==} + follow-redirects@1.15.11: + resolution: {integrity: sha512-deG2P0JfjrTxl50XGCDyfI97ZGVCxIpfKYmfyrQ54n5FO/0gfIES8C/Psl6kWVDolizcaaxZJnTS0QSMxvnsBQ==} engines: {node: '>=4.0'} peerDependencies: debug: '*' @@ -2711,10 +2724,6 @@ snapshots: '@vue/shared@3.5.26': {} - acorn-jsx@5.3.2(acorn@8.14.1): - dependencies: - acorn: 8.14.1 - acorn-jsx@5.3.2(acorn@8.15.0): dependencies: acorn: 8.15.0 @@ -2772,9 +2781,9 @@ snapshots: asynckit@0.4.0: {} - axios@1.12.0: + axios@1.13.5: dependencies: - follow-redirects: 1.15.6 + follow-redirects: 1.15.11 form-data: 4.0.5 proxy-from-env: 1.1.0 transitivePeerDependencies: @@ -3047,8 +3056,8 @@ snapshots: espree@9.6.1: dependencies: - acorn: 8.14.1 - acorn-jsx: 5.3.2(acorn@8.14.1) + acorn: 8.15.0 + acorn-jsx: 5.3.2(acorn@8.15.0) eslint-visitor-keys: 3.4.3 esquery@1.5.0: @@ -3101,7 +3110,7 @@ snapshots: flatted@3.3.1: {} - follow-redirects@1.15.6: {} + follow-redirects@1.15.11: {} form-data@4.0.5: dependencies: @@ -3753,14 +3762,14 @@ snapshots: vue-eslint-parser@9.4.3(eslint@9.39.2): dependencies: - debug: 4.4.0 + debug: 4.4.3 eslint: 9.39.2 eslint-scope: 7.2.2 eslint-visitor-keys: 3.4.3 espree: 9.6.1 esquery: 1.5.0 lodash: 4.17.21 - semver: 7.7.1 + semver: 7.7.3 transitivePeerDependencies: - supports-color diff --git a/src/api/ArticleAPI.ts b/src/api/ArticleAPI.ts index 8c32aed..597d918 100644 --- a/src/api/ArticleAPI.ts +++ b/src/api/ArticleAPI.ts @@ -1,4 +1,5 @@ -import { ArticleView, axios } from "timi-web"; +import { ArticleView } from "../types"; +import { axios } from "./BaseAPI"; /** * 获取文章 diff --git a/src/api/BaseAPI.ts b/src/api/BaseAPI.ts new file mode 100644 index 0000000..1eff146 --- /dev/null +++ b/src/api/BaseAPI.ts @@ -0,0 +1,16 @@ +import Network from "../utils/Network"; + +let serviceAxios: any | null = null; + +function getServiceAxios(): any { + if (serviceAxios === null) { + serviceAxios = Network.axios; + } + return serviceAxios; +} + +export const axios = new Proxy({} as any, { + get(_target: any, prop: string | symbol, receiver: any): any { + return Reflect.get(getServiceAxios(), prop, receiver); + } +}); diff --git a/src/api/CommentAPI.ts b/src/api/CommentAPI.ts index d72d947..825ca62 100644 --- a/src/api/CommentAPI.ts +++ b/src/api/CommentAPI.ts @@ -1,4 +1,5 @@ -import { axios, CaptchaData, Comment, CommentReply, Page, PageResult } from "~/index"; +import { CaptchaData, Comment, CommentReply, Page, PageResult } from "../types"; +import { axios } from "./BaseAPI"; const BASE_URI = "/comment"; diff --git a/src/api/CommonAPI.ts b/src/api/CommonAPI.ts index 9691e36..59e30d2 100644 --- a/src/api/CommonAPI.ts +++ b/src/api/CommonAPI.ts @@ -1,4 +1,6 @@ -import { axios, SettingKey, TemplateBizType, Toolkit } from "~/index"; +import { TemplateBizType } from "../types"; +import Toolkit from "../utils/Toolkit"; +import { axios } from "./BaseAPI"; const getCaptchaAPI = () => axios.defaults.baseURL + "/captcha"; diff --git a/src/api/DeveloperAPI.ts b/src/api/DeveloperAPI.ts index 4fdf7a3..a79a62b 100644 --- a/src/api/DeveloperAPI.ts +++ b/src/api/DeveloperAPI.ts @@ -1,4 +1,5 @@ -import { axios, Developer } from "~/index"; +import { Developer } from "../types"; +import { axios } from "./BaseAPI"; const BASE_URI = "/git/developer"; diff --git a/src/api/UserAPI.ts b/src/api/UserAPI.ts index cd3fb51..50f4564 100644 --- a/src/api/UserAPI.ts +++ b/src/api/UserAPI.ts @@ -1,15 +1,15 @@ import { Attachment, - axios, CaptchaData, - CommonAPI, LoginRequest, LoginResponse, RegisterRequest, UserAttachType, UserProfileView, UserView -} from "~/index"; +} from "../types"; +import { axios } from "./BaseAPI"; +import CommonAPI from "./CommonAPI"; const BASE_URI = "/user"; diff --git a/src/api/index.ts b/src/api/index.ts new file mode 100644 index 0000000..23fca08 --- /dev/null +++ b/src/api/index.ts @@ -0,0 +1,5 @@ +export * from "./ArticleAPI"; +export * from "./CommentAPI"; +export * from "./CommonAPI"; +export * from "./DeveloperAPI" +export * from "./UserAPI"; diff --git a/src/assets/style/timi-web.less b/src/assets/style/timi-web.less index 06b71b7..5508d2e 100644 --- a/src/assets/style/timi-web.less +++ b/src/assets/style/timi-web.less @@ -1,18 +1,18 @@ -@import url(~/assets/style/variable); +@import url(./variable); -*::-webkit-scrollbar { +.custom-scroll-bar *::-webkit-scrollbar { width: 10px !important; height: 10px !important; cursor: var(--tui-cur-default); background: #CFD2E0; } -*::-webkit-scrollbar-corner { +.custom-scroll-bar *::-webkit-scrollbar-corner { background: #CFD2E0; cursor: var(--tui-cur-default); } -*::-webkit-scrollbar-thumb { +.custom-scroll-bar *::-webkit-scrollbar-thumb { cursor: var(--tui-cur-default); background: #525870; } diff --git a/src/components/background-effect/flower-fall/index.ts b/src/components/background-effect/flower-fall/index.ts index 387550e..2601dea 100644 --- a/src/components/background-effect/flower-fall/index.ts +++ b/src/components/background-effect/flower-fall/index.ts @@ -1,5 +1,5 @@ import view from "./index.vue"; -import Toolkit from "~/utils/Toolkit"; +import Toolkit from "../../../utils/Toolkit"; export const BEFlowerFall = Toolkit.withInstall(view); export default BEFlowerFall; diff --git a/src/components/background-effect/flower-fall/index.vue b/src/components/background-effect/flower-fall/index.vue index f18f6e6..75dab29 100644 --- a/src/components/background-effect/flower-fall/index.vue +++ b/src/components/background-effect/flower-fall/index.vue @@ -5,8 +5,8 @@