diff --git a/plugins/index.ts b/plugins/index.ts
index 9ea9fc3..7675324 100644
--- a/plugins/index.ts
+++ b/plugins/index.ts
@@ -1,3 +1,3 @@
-export * from './_404Page';
export * from './commit';
export * from './mirror';
+export * from './unAutoImport';
diff --git a/plugins/mirror.ts b/plugins/mirror.ts
index 8a56784..8ca9da3 100644
--- a/plugins/mirror.ts
+++ b/plugins/mirror.ts
@@ -14,13 +14,15 @@ export const mirror = (): Plugin => {
apply: 'build',
enforce: 'post',
config() {
- return {
- experimental: {
- renderBuiltUrl(filename) {
- return mirrorBaseUrl + '/' + filename;
+ if (process.env.MIRROR == `ON`) {
+ return {
+ experimental: {
+ renderBuiltUrl(filename) {
+ return mirrorBaseUrl + '/' + filename;
+ },
},
- },
- };
+ };
+ }
},
};
};
diff --git a/plugins/naive-components.json b/plugins/naive-components.json
new file mode 100644
index 0000000..b4bccef
--- /dev/null
+++ b/plugins/naive-components.json
@@ -0,0 +1,152 @@
+[
+ "NA",
+ "NAffix",
+ "NAlert",
+ "NAnchor",
+ "NAnchorLink",
+ "NAutoComplete",
+ "NAvatar",
+ "NAvatarGroup",
+ "NBackTop",
+ "NBadge",
+ "NBlockquote",
+ "NBreadcrumb",
+ "NBreadcrumbItem",
+ "NButton",
+ "NButtonGroup",
+ "NCalendar",
+ "NCard",
+ "NCarousel",
+ "NCarouselItem",
+ "NCascader",
+ "NCheckbox",
+ "NCheckboxGroup",
+ "NCode",
+ "NCol",
+ "NCollapse",
+ "NCollapseItem",
+ "NCollapseTransition",
+ "NColorPicker",
+ "NConfigProvider",
+ "NCountdown",
+ "NDataTable",
+ "NDatePicker",
+ "NDescriptions",
+ "NDescriptionsItem",
+ "NDialog",
+ "NDialogProvider",
+ "NDivider",
+ "NDrawer",
+ "NDrawerContent",
+ "NDropdown",
+ "NDynamicInput",
+ "NDynamicTags",
+ "NEl",
+ "NElement",
+ "NEllipsis",
+ "NEmpty",
+ "NEquation",
+ "NFlex",
+ "NFloatButton",
+ "NFloatButtonGroup",
+ "NForm",
+ "NFormItem",
+ "NFormItemCol",
+ "NFormItemGi",
+ "NFormItemGridItem",
+ "NFormItemRow",
+ "NGi",
+ "NGlobalStyle",
+ "NGradientText",
+ "NGrid",
+ "NGridItem",
+ "NH1",
+ "NH2",
+ "NH3",
+ "NH4",
+ "NH5",
+ "NH6",
+ "NHr",
+ "NIcon",
+ "NIconWrapper",
+ "NImage",
+ "NImageGroup",
+ "NInfiniteScroll",
+ "NInput",
+ "NInputGroup",
+ "NInputGroupLabel",
+ "NInputNumber",
+ "NLayout",
+ "NLayoutContent",
+ "NLayoutFooter",
+ "NLayoutHeader",
+ "NLayoutSider",
+ "NLegacyTransfer",
+ "NLi",
+ "NList",
+ "NListItem",
+ "NLoadingBarProvider",
+ "NLog",
+ "NMention",
+ "NMenu",
+ "NMessageProvider",
+ "NModal",
+ "NModalProvider",
+ "NNotificationProvider",
+ "NNumberAnimation",
+ "NOl",
+ "NP",
+ "NPageHeader",
+ "NPagination",
+ "NPerformantEllipsis",
+ "NPopconfirm",
+ "NPopover",
+ "NPopselect",
+ "NProgress",
+ "NQrCode",
+ "NRadio",
+ "NRadioButton",
+ "NRadioGroup",
+ "NRate",
+ "NResult",
+ "NRow",
+ "NScrollbar",
+ "NSelect",
+ "NSkeleton",
+ "NSlider",
+ "NSpace",
+ "NSpin",
+ "NSplit",
+ "NStatistic",
+ "NStep",
+ "NSteps",
+ "NSwitch",
+ "NTab",
+ "NTabPane",
+ "NTable",
+ "NTabs",
+ "NTag",
+ "NTbody",
+ "NTd",
+ "NText",
+ "NTh",
+ "NThead",
+ "NThemeEditor",
+ "NThing",
+ "NTime",
+ "NTimePicker",
+ "NTimeline",
+ "NTimelineItem",
+ "NTooltip",
+ "NTr",
+ "NTransfer",
+ "NTree",
+ "NTreeSelect",
+ "NUl",
+ "NUpload",
+ "NUploadDragger",
+ "NUploadFileList",
+ "NUploadTrigger",
+ "NVirtualList",
+ "NWatermark"
+]
diff --git a/plugins/unAutoImport.ts b/plugins/unAutoImport.ts
new file mode 100644
index 0000000..3d36293
--- /dev/null
+++ b/plugins/unAutoImport.ts
@@ -0,0 +1,38 @@
+import autoImport from 'unplugin-auto-import/vite';
+import { NaiveUiResolver } from 'unplugin-vue-components/resolvers';
+import components from 'unplugin-vue-components/vite';
+import type { Plugin } from 'vite';
+import naiveComponents from './naive-components.json';
+
+export const unAutoImport = (): Plugin[] => {
+ return [
+ autoImport({
+ dts: 'auto-import.d.ts',
+ imports: [
+ 'vue',
+ 'vue-router',
+ '@vueuse/core',
+ {
+ 'naive-ui': [
+ 'useDialog',
+ 'useMessage',
+ 'useNotification',
+ 'useLoadingBar',
+ ...naiveComponents,
+ ],
+ },
+ ],
+ eslintrc: {
+ enabled: true,
+ globalsPropValue: 'readonly',
+ filepath: '.eslintrc-auto-import.json',
+ },
+ dirs: [],
+ }),
+ components({
+ dts: 'auto-import-components.d.ts',
+ resolvers: [NaiveUiResolver()],
+ dirs: [],
+ }),
+ ];
+};
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index d2106a2..2985499 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -1135,9 +1135,6 @@ packages:
'@jridgewell/source-map@0.3.6':
resolution: {integrity: sha512-1ZJTZebgqllO79ue2bm3rIGud/bOe0pP5BjSRCRxxYkEZS8STV7zN84UBbiYu7jy+eCKSnVIUgoWWE/tt+shMQ==}
- '@jridgewell/sourcemap-codec@1.4.15':
- resolution: {integrity: sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==}
-
'@jridgewell/sourcemap-codec@1.5.0':
resolution: {integrity: sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==}
@@ -3545,7 +3542,7 @@ snapshots:
'@babel/traverse': 7.24.7
'@babel/types': 7.24.7
convert-source-map: 2.0.0
- debug: 4.3.5
+ debug: 4.3.6
gensync: 1.0.0-beta.2
json5: 2.2.3
semver: 6.3.1
@@ -3565,7 +3562,7 @@ snapshots:
'@babel/traverse': 7.25.2
'@babel/types': 7.25.2
convert-source-map: 2.0.0
- debug: 4.3.5
+ debug: 4.3.6
gensync: 1.0.0-beta.2
json5: 2.2.3
semver: 6.3.1
@@ -3655,7 +3652,7 @@ snapshots:
'@babel/core': 7.24.7
'@babel/helper-compilation-targets': 7.24.7
'@babel/helper-plugin-utils': 7.24.7
- debug: 4.3.5
+ debug: 4.3.6
lodash.debounce: 4.0.8
resolve: 1.22.8
transitivePeerDependencies:
@@ -4445,7 +4442,7 @@ snapshots:
'@babel/helper-split-export-declaration': 7.24.7
'@babel/parser': 7.24.7
'@babel/types': 7.24.7
- debug: 4.3.5
+ debug: 4.3.6
globals: 11.12.0
transitivePeerDependencies:
- supports-color
@@ -4457,7 +4454,7 @@ snapshots:
'@babel/parser': 7.25.0
'@babel/template': 7.25.0
'@babel/types': 7.25.2
- debug: 4.3.5
+ debug: 4.3.6
globals: 11.12.0
transitivePeerDependencies:
- supports-color
@@ -4599,7 +4596,7 @@ snapshots:
'@antfu/install-pkg': 0.1.1
'@antfu/utils': 0.7.10
'@iconify/types': 2.0.0
- debug: 4.3.5
+ debug: 4.3.6
kolorist: 1.8.0
local-pkg: 0.5.0
mlly: 1.7.1
@@ -4621,7 +4618,7 @@ snapshots:
'@jridgewell/gen-mapping@0.3.5':
dependencies:
'@jridgewell/set-array': 1.2.1
- '@jridgewell/sourcemap-codec': 1.4.15
+ '@jridgewell/sourcemap-codec': 1.5.0
'@jridgewell/trace-mapping': 0.3.25
'@jridgewell/resolve-uri@3.1.2': {}
@@ -4633,14 +4630,12 @@ snapshots:
'@jridgewell/gen-mapping': 0.3.5
'@jridgewell/trace-mapping': 0.3.25
- '@jridgewell/sourcemap-codec@1.4.15': {}
-
'@jridgewell/sourcemap-codec@1.5.0': {}
'@jridgewell/trace-mapping@0.3.25':
dependencies:
'@jridgewell/resolve-uri': 3.1.2
- '@jridgewell/sourcemap-codec': 1.4.15
+ '@jridgewell/sourcemap-codec': 1.5.0
'@juggle/resize-observer@3.4.0': {}
@@ -4814,7 +4809,7 @@ snapshots:
dependencies:
'@typescript-eslint/typescript-estree': 7.14.1(typescript@5.5.4)
'@typescript-eslint/utils': 7.14.1(eslint@8.57.0)(typescript@5.5.4)
- debug: 4.3.5
+ debug: 4.3.6
eslint: 8.57.0
ts-api-utils: 1.3.0(typescript@5.5.4)
optionalDependencies:
@@ -4828,7 +4823,7 @@ snapshots:
dependencies:
'@typescript-eslint/types': 7.14.1
'@typescript-eslint/visitor-keys': 7.14.1
- debug: 4.3.5
+ debug: 4.3.6
globby: 11.1.0
is-glob: 4.0.3
minimatch: 9.0.5
@@ -5122,7 +5117,7 @@ snapshots:
'@vue/compiler-ssr': 3.4.31
'@vue/shared': 3.4.31
estree-walker: 2.0.2
- magic-string: 0.30.10
+ magic-string: 0.30.11
postcss: 8.4.39
source-map-js: 1.2.0
@@ -6161,7 +6156,7 @@ snapshots:
magic-string@0.30.10:
dependencies:
- '@jridgewell/sourcemap-codec': 1.4.15
+ '@jridgewell/sourcemap-codec': 1.5.0
magic-string@0.30.11:
dependencies:
@@ -6717,7 +6712,7 @@ snapshots:
estree-walker: 3.0.3
fast-glob: 3.3.2
local-pkg: 0.5.0
- magic-string: 0.30.10
+ magic-string: 0.30.11
mlly: 1.7.1
pathe: 1.1.2
pkg-types: 1.1.3
@@ -6770,7 +6765,7 @@ snapshots:
'@rollup/pluginutils': 5.1.0(rollup@4.18.0)
fast-glob: 3.3.2
local-pkg: 0.5.0
- magic-string: 0.30.10
+ magic-string: 0.30.11
minimatch: 9.0.5
unimport: 3.9.0(rollup@4.18.0)
unplugin: 1.12.0
@@ -6784,10 +6779,10 @@ snapshots:
'@antfu/utils': 0.7.10
'@rollup/pluginutils': 5.1.0(rollup@4.18.0)
chokidar: 3.6.0
- debug: 4.3.5
+ debug: 4.3.6
fast-glob: 3.3.2
local-pkg: 0.5.0
- magic-string: 0.30.10
+ magic-string: 0.30.11
minimatch: 9.0.5
mlly: 1.7.1
unplugin: 1.12.0
diff --git a/src/App.vue b/src/App.vue
index 03f57bf..6e918f3 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -1,5 +1,5 @@
diff --git a/src/components/ActionCard.vue b/src/components/ActionCard.vue
index e1e3dc0..37cc0b5 100644
--- a/src/components/ActionCard.vue
+++ b/src/components/ActionCard.vue
@@ -16,7 +16,6 @@ import {
import { useTask } from '@/utils/task';
import type { Snapshot } from '@/utils/types';
import { getImportUrl, githubUrlToSelfUrl } from '@/utils/url';
-import { NButton, NIcon, NPopconfirm, NPopover, NSpace } from 'naive-ui';
const props = withDefaults(
defineProps<{
diff --git a/src/components/ErrorDlg.vue b/src/components/ErrorDlg.vue
index 1cb6529..966097f 100644
--- a/src/components/ErrorDlg.vue
+++ b/src/components/ErrorDlg.vue
@@ -1,8 +1,6 @@
import { copy } from '@/utils/others';
import type { RawNode } from '@/utils/types';
-import { NEllipsis, NIcon, NTable, NTbody, NTd, NTooltip, NTr } from 'naive-ui';
import DraggableCard from '@/components/DraggableCard.vue';
const props = withDefaults(defineProps<{ focusNode: RawNode }>(), {});
diff --git a/src/views/snapshot/MultiFocusCard.vue b/src/views/snapshot/MultiFocusCard.vue
index 23cd01d..3f2894d 100644
--- a/src/views/snapshot/MultiFocusCard.vue
+++ b/src/views/snapshot/MultiFocusCard.vue
@@ -2,7 +2,6 @@
import { getNodeLabel } from '@/utils/node';
import { buildEmptyFn } from '@/utils/others';
import type { RawNode } from '@/utils/types';
-import { NCard, NSpace, NButton } from 'naive-ui';
import DraggableCard from '@/components/DraggableCard.vue';
const props = withDefaults(
diff --git a/src/views/snapshot/SearchCard.vue b/src/views/snapshot/SearchCard.vue
index 32e6e29..7b8193e 100644
--- a/src/views/snapshot/SearchCard.vue
+++ b/src/views/snapshot/SearchCard.vue
@@ -10,18 +10,6 @@ import type { RawNode, Snapshot } from '@/utils/types';
import { getImportUrl, githubUrlToSelfUrl } from '@/utils/url';
import dayjs from 'dayjs';
import JSON5 from 'json5';
-import {
- NButton,
- NButtonGroup,
- NCollapse,
- NCollapseItem,
- NIcon,
- NInput,
- NInputGroup,
- NRadio,
- NRadioGroup,
- NSpace,
-} from 'naive-ui';
import * as base64url from 'universal-base64url';
import DraggableCard from '@/components/DraggableCard.vue';
import { gkdWidth, vw } from '@/utils/size';
diff --git a/src/views/snapshot/SnapshotPage.vue b/src/views/snapshot/SnapshotPage.vue
index 3bac927..d8af783 100644
--- a/src/views/snapshot/SnapshotPage.vue
+++ b/src/views/snapshot/SnapshotPage.vue
@@ -17,7 +17,6 @@ import {
snapshotStorage,
} from '@/utils/storage';
import type { RawNode, Snapshot } from '@/utils/types';
-import { NIcon, NModal } from 'naive-ui';
import AttrCard from './AttrCard.vue';
import MultiFocusCard from './MultiFocusCard.vue';
import ScreenshotCard from './ScreenshotCard.vue';
diff --git a/src/views/snapshot/WindowCard.vue b/src/views/snapshot/WindowCard.vue
index 4f4db54..4aa9211 100644
--- a/src/views/snapshot/WindowCard.vue
+++ b/src/views/snapshot/WindowCard.vue
@@ -8,7 +8,6 @@ import {
import { buildEmptyFn, copy, delay } from '@/utils/others';
import type { RawNode, Snapshot } from '@/utils/types';
import type { TreeInst } from 'naive-ui';
-import { NTooltip, NTree, NIcon, NButton } from 'naive-ui';
import type { HTMLAttributes } from 'vue';
import GapList from '@/components/GapList';
diff --git a/vite.config.ts b/vite.config.ts
index 187ee5e..b9ac12d 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -1,42 +1,25 @@
import legacy from '@vitejs/plugin-legacy';
import vue from '@vitejs/plugin-vue';
import vueJsx from '@vitejs/plugin-vue-jsx';
-import { fileURLToPath, URL } from 'node:url';
+import process from 'node:process';
import unocss from 'unocss/vite';
import { defineConfig } from 'vite';
-import { _404Page, commit, mirror } from './plugins';
-import components from 'unplugin-vue-components/vite';
-import autoImport from 'unplugin-auto-import/vite';
+import { commit, mirror, unAutoImport } from './plugins';
export default defineConfig(() => {
- const useMirror = process.env.MIRROR == `ON`;
return {
plugins: [
vue(),
vueJsx(),
unocss(),
- autoImport({
- dts: 'auto-import.d.ts',
- imports: ['vue', 'vue-router', '@vueuse/core'],
- eslintrc: {
- enabled: true,
- globalsPropValue: 'readonly',
- filepath: '.eslintrc-auto-import.json',
- },
- dirs: [],
- }),
- components({
- dts: 'auto-import-components.d.ts',
- dirs: [],
- }),
+ unAutoImport(),
legacy({ renderLegacyChunks: false, modernPolyfills: true }),
commit(),
- useMirror ? mirror() : undefined,
- _404Page(),
+ mirror(),
],
resolve: {
alias: {
- '@': fileURLToPath(new URL('./src', import.meta.url)),
+ '@': process.cwd() + '/src',
},
},
server: {