Skip to content

Commit a775d3f

Browse files
committed
better conf
1 parent 09bc926 commit a775d3f

File tree

7 files changed

+212
-6
lines changed

7 files changed

+212
-6
lines changed

auto-imports.d.ts

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
// Generated by 'unplugin-auto-import'
2+
// We suggest you to commit this file into source control
3+
declare global {
4+
const computed: typeof import('vue-tui')['computed']
5+
const createApp: typeof import('vue-tui')['createApp']
6+
const customRef: typeof import('vue-tui')['customRef']
7+
const defineAsyncComponent: typeof import('vue-tui')['defineAsyncComponent']
8+
const defineComponent: typeof import('vue-tui')['defineComponent']
9+
const effectScope: typeof import('vue-tui')['effectScope']
10+
const EffectScope: typeof import('vue-tui')['EffectScope']
11+
const getCurrentInstance: typeof import('vue-tui')['getCurrentInstance']
12+
const getCurrentScope: typeof import('vue-tui')['getCurrentScope']
13+
const h: typeof import('vue-tui')['h']
14+
const inject: typeof import('vue-tui')['inject']
15+
const isReadonly: typeof import('vue-tui')['isReadonly']
16+
const isRef: typeof import('vue-tui')['isRef']
17+
const markRaw: typeof import('vue-tui')['markRaw']
18+
const nextTick: typeof import('vue-tui')['nextTick']
19+
const onActivated: typeof import('vue-tui')['onActivated']
20+
const onBeforeMount: typeof import('vue-tui')['onBeforeMount']
21+
const onBeforeUnmount: typeof import('vue-tui')['onBeforeUnmount']
22+
const onBeforeUpdate: typeof import('vue-tui')['onBeforeUpdate']
23+
const onDeactivated: typeof import('vue-tui')['onDeactivated']
24+
const onErrorCaptured: typeof import('vue-tui')['onErrorCaptured']
25+
const onMounted: typeof import('vue-tui')['onMounted']
26+
const onRenderTracked: typeof import('vue-tui')['onRenderTracked']
27+
const onRenderTriggered: typeof import('vue-tui')['onRenderTriggered']
28+
const onScopeDispose: typeof import('vue-tui')['onScopeDispose']
29+
const onServerPrefetch: typeof import('vue-tui')['onServerPrefetch']
30+
const onUnmounted: typeof import('vue-tui')['onUnmounted']
31+
const onUpdated: typeof import('vue-tui')['onUpdated']
32+
const provide: typeof import('vue-tui')['provide']
33+
const reactive: typeof import('vue-tui')['reactive']
34+
const readonly: typeof import('vue-tui')['readonly']
35+
const ref: typeof import('vue-tui')['ref']
36+
const resolveComponent: typeof import('vue-tui')['resolveComponent']
37+
const shallowReactive: typeof import('vue-tui')['shallowReactive']
38+
const shallowReadonly: typeof import('vue-tui')['shallowReadonly']
39+
const shallowRef: typeof import('vue-tui')['shallowRef']
40+
const toRaw: typeof import('vue-tui')['toRaw']
41+
const toRef: typeof import('vue-tui')['toRef']
42+
const toRefs: typeof import('vue-tui')['toRefs']
43+
const triggerRef: typeof import('vue-tui')['triggerRef']
44+
const unref: typeof import('vue-tui')['unref']
45+
const useAttrs: typeof import('vue-tui')['useAttrs']
46+
const useSlots: typeof import('vue-tui')['useSlots']
47+
const watch: typeof import('vue-tui')['watch']
48+
const watchEffect: typeof import('vue-tui')['watchEffect']
49+
}
50+
export {}

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"@types/node": "^17.0.18",
1616
"@vitejs/plugin-vue": "^2.2.0",
1717
"typescript": "^4.5.4",
18+
"unplugin-auto-import": "^0.6.0",
1819
"vite": "^2.8.0",
1920
"vue": "^3.2.25",
2021
"vue-tsc": "^0.31.4"

pnpm-lock.yaml

+71
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/tui/App.vue

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
<script setup lang="ts">
2-
import { ref, onMounted, onUnmounted } from './renderer'
32
const n = ref(0)
43
54
onMounted(() => {

src/tui/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
import App from './App.vue'
2-
import { createApp } from './renderer'
2+
import { createApp } from 'vue-tui'
33

44
createApp(App).mount()

tsconfig.json

+12-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"compilerOptions": {
3+
"baseUrl": ".",
34
"target": "esnext",
45
"useDefineForClassFields": true,
56
"module": "esnext",
@@ -9,8 +10,17 @@
910
"sourceMap": true,
1011
"resolveJsonModule": true,
1112
"esModuleInterop": true,
12-
"lib": ["esnext"]
13+
"lib": ["esnext"],
14+
"paths": {
15+
"vue-tui": ["src/tui/renderer/index.ts"]
16+
}
1317
},
14-
"include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"],
18+
"include": [
19+
"auto-imports.d.ts",
20+
"src/**/*.ts",
21+
"src/**/*.d.ts",
22+
"src/**/*.tsx",
23+
"src/**/*.vue"
24+
],
1525
"references": [{ "path": "./tsconfig.node.json" }]
1626
}

vite.config.ts

+77-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,75 @@
11
import { defineConfig } from 'vite'
2-
import vue from '@vitejs/plugin-vue'
2+
import Vue from '@vitejs/plugin-vue'
3+
import AutoImport from 'unplugin-auto-import/vite'
4+
const VueTuiExports = [
5+
// lifecycle
6+
'onActivated',
7+
'onBeforeMount',
8+
'onBeforeUnmount',
9+
'onBeforeUpdate',
10+
'onErrorCaptured',
11+
'onDeactivated',
12+
'onMounted',
13+
'onServerPrefetch',
14+
'onUnmounted',
15+
'onUpdated',
16+
17+
// setup helpers
18+
'useAttrs',
19+
'useSlots',
20+
21+
// reactivity,
22+
'computed',
23+
'customRef',
24+
'isReadonly',
25+
'isRef',
26+
'markRaw',
27+
'reactive',
28+
'readonly',
29+
'ref',
30+
'shallowReactive',
31+
'shallowReadonly',
32+
'shallowRef',
33+
'triggerRef',
34+
'toRaw',
35+
'toRef',
36+
'toRefs',
37+
'unref',
38+
'watch',
39+
'watchEffect',
40+
41+
// component
42+
'defineComponent',
43+
'defineAsyncComponent',
44+
'getCurrentInstance',
45+
'h',
46+
'inject',
47+
'nextTick',
48+
'provide',
49+
// 'useCssModule',
50+
'createApp',
51+
52+
// effect scope
53+
'effectScope',
54+
'EffectScope',
55+
'getCurrentScope',
56+
'onScopeDispose',
57+
58+
// Vue 3 only
59+
'onRenderTracked',
60+
'onRenderTriggered',
61+
'resolveComponent',
62+
// 'useCssVars',
63+
]
364

465
export default defineConfig({
566
mode: 'build',
667
publicDir: false,
68+
resolve: {
69+
alias: {
70+
'vue-tui': './src/tui/renderer/index.ts',
71+
},
72+
},
773
build: {
874
minify: false,
975
rollupOptions: {
@@ -23,5 +89,14 @@ export default defineConfig({
2389
include: ['src/tui/index.ts'],
2490
},
2591
},
26-
plugins: [vue()],
92+
plugins: [
93+
AutoImport({
94+
imports: [
95+
{
96+
'vue-tui': VueTuiExports,
97+
},
98+
],
99+
}),
100+
Vue(),
101+
],
27102
})

0 commit comments

Comments
 (0)