-
-
Notifications
You must be signed in to change notification settings - Fork 49
Expand file tree
/
Copy pathvite.config.ts
More file actions
139 lines (135 loc) · 4.07 KB
/
vite.config.ts
File metadata and controls
139 lines (135 loc) · 4.07 KB
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
import path from 'node:path'
import { defineConfig } from 'vp'
import { playwright } from 'vp/test/browser-playwright'
// Shared aliases used by both projects
const alias = {
'mppx/client': path.resolve(import.meta.dirname, 'src/client'),
'mppx/discovery': path.resolve(import.meta.dirname, 'src/discovery'),
'mppx/mcp-sdk/client': path.resolve(import.meta.dirname, 'src/mcp-sdk/client'),
'mppx/mcp-sdk/server': path.resolve(import.meta.dirname, 'src/mcp-sdk/server'),
'mppx/proxy': path.resolve(import.meta.dirname, 'src/proxy'),
'mppx/server': path.resolve(import.meta.dirname, 'src/server'),
'mppx/tempo': path.resolve(import.meta.dirname, 'src/tempo'),
'mppx/hono': path.resolve(import.meta.dirname, 'src/middlewares/hono'),
'mppx/express': path.resolve(import.meta.dirname, 'src/middlewares/express'),
'mppx/nextjs': path.resolve(import.meta.dirname, 'src/middlewares/nextjs'),
'mppx/elysia': path.resolve(import.meta.dirname, 'src/middlewares/elysia'),
'mppx/stripe': path.resolve(import.meta.dirname, 'src/stripe'),
'mppx/stripe/client': path.resolve(import.meta.dirname, 'src/stripe/client'),
'mppx/stripe/server': path.resolve(import.meta.dirname, 'src/stripe/server'),
mppx: path.resolve(import.meta.dirname, 'src'),
'~test': path.resolve(import.meta.dirname, 'test'),
}
const sharedTempoRpcTestOptions = {
fileParallelism: false,
}
export default defineConfig({
test: {
coverage: {
include: ['src/**'],
exclude: ['test/**', 'src/cli/**', 'src/bin.ts', '**/*.test-d.ts'],
thresholds: {
statements: 70,
branches: 70,
functions: 70,
},
},
globalSetup: ['./test/setup.global.ts'],
projects: [
{
test: {
name: 'node',
alias,
include: ['src/**/*.test.ts'],
exclude: ['**/node_modules/**', 'src/**/*.browser.test.ts', 'src/cli/**/*.test.ts'],
typecheck: {
include: ['src/**/*.test-d.ts'],
},
...sharedTempoRpcTestOptions,
globals: true,
retry: 3,
testTimeout: 10_000,
hookTimeout: 60_000,
},
},
{
test: {
name: 'cli',
alias,
include: ['src/cli/**/*.test.ts'],
...sharedTempoRpcTestOptions,
globals: true,
retry: 3,
testTimeout: 10_000,
hookTimeout: 60_000,
},
},
{
resolve: {
alias: {
// constantTimeEqual uses node:crypto which is unavailable in browser.
// The browser tests don't exercise challenge verification, so a shim is fine.
'./internal/constantTimeEqual.js': path.resolve(
import.meta.dirname,
'test/browser/constantTimeEqual.shim.ts',
),
},
},
test: {
name: 'browser',
alias,
include: ['src/**/*.browser.test.ts'],
globals: true,
retry: 1,
testTimeout: 10_000,
browser: {
enabled: true,
headless: true,
provider: playwright(),
instances: [{ browser: 'chromium' }],
},
},
},
],
},
lint: {
categories: {
correctness: 'error',
suspicious: 'warn',
},
plugins: ['typescript', 'oxc'],
env: {
builtin: true,
},
rules: {
'typescript/no-non-null-assertion': 'off',
'typescript/no-explicit-any': 'off',
'no-shadow-restricted-names': 'off',
'no-shadow': 'off',
'no-control-regex': 'off',
},
settings: {
polyfills: ['PaymentRequest', 'URLPattern', 'crypto', 'navigator'],
},
overrides: [
{
files: ['src/**/*.ts'],
rules: {
'compat/compat': 'error',
},
jsPlugins: ['eslint-plugin-compat'],
},
],
},
fmt: {
singleQuote: true,
semi: false,
sortImports: {},
sortPackageJson: false,
},
staged: {
'*': 'vp fmt --write --no-error-on-unmatched-pattern',
'*.{js,jsx,ts,tsx,mjs,cjs}': 'vp lint --fix',
'*.{ts,tsx}': "bash -c 'vp check'",
},
})