-
Notifications
You must be signed in to change notification settings - Fork 47
/
vite.config.mts
110 lines (107 loc) · 2.43 KB
/
vite.config.mts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
import path from 'node:path';
import { externalizeDeps as external } from 'vite-plugin-externalize-deps';
import { viteStaticCopy as copy } from 'vite-plugin-static-copy';
import tsconfigPaths from 'vite-tsconfig-paths';
import { defineConfig } from 'vitest/config';
// https://vitejs.dev/config/
export default defineConfig(api => {
const isDev = api.mode === 'development';
return {
resolve: {
alias: {
// hack bindings of sqlite3
bindings: path.join(__dirname, 'vendors/bindings/index.js'),
// hack onnxruntime-node
'onnxruntime-node': path.join(__dirname, 'vendors/onnxruntime-node/index.cjs'),
},
},
plugins: [
external({
deps: false,
include: ['vscode'],
}),
tsconfigPaths(),
copy({
targets: [
{
src: 'node_modules/@unit-mesh/treesitter-artifacts/wasm/*.wasm',
dest: 'tree-sitter-wasms',
},
{
src: 'node_modules/web-tree-sitter/*.wasm',
dest: '',
},
{
src: 'src/code-search/schemas/indexes/*.scm',
dest: 'semantic',
},
{
src: 'node_modules/onnxruntime-node/bin',
dest: '',
},
{
src: 'node_modules/sqlite3/build',
dest: '',
},
{
src: 'node_modules/@lancedb',
dest: 'node_modules/',
},
{
src: 'bin/**',
dest: 'build/',
},
{
src: 'package.json',
dest: '',
},
{
src: 'models/',
dest: '',
},
{
src: 'autodev_tutorial.py',
dest: '',
},
],
}),
],
build: {
minify: !isDev,
sourcemap: isDev,
copyPublicDir: false,
lib: {
entry: 'src/extension.ts',
formats: ['cjs'],
fileName: 'extension',
},
commonjsOptions: {
ignoreDynamicRequires: true,
dynamicRequireRoot: '/',
dynamicRequireTargets: ['./bin/napi-v3/**/onnxruntime_binding.node'],
},
rollupOptions: {
output: {
inlineDynamicImports: true,
},
},
},
test: {
setupFiles: 'tests/vitest.setup.ts',
include: ['src/test/**/*.test.ts'],
globals: true,
coverage: {
// you can include other reporters, but 'json-summary' is required, json is recommended
reporter: ['text', 'json-summary', 'json'],
// If you want a coverage reports even if your tests are failing, include the reportOnFailure option
reportOnFailure: true,
// thresholds: {
// lines: 10,
// branches: 10,
// functions: 10,
// statements: 10
// }
},
},
};
});