Skip to content

Commit 290d324

Browse files
committed
refactor(cli): move UserConfig module augmentation to define-config.ts
Move the `declare module '@voidzero-dev/vite-plus-core'` augmentation from index.ts to define-config.ts where the augmented UserConfig type is actually used. This keeps the augmentation and its usage together, simplifies index.ts to pure re-exports, and avoids tsdown DTS bundling issues with cross-file namespace references.
1 parent 7caaa09 commit 290d324

2 files changed

Lines changed: 30 additions & 30 deletions

File tree

packages/cli/src/define-config.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,37 @@ import type { UserConfig } from '@voidzero-dev/vite-plus-core';
22
import {
33
defineConfig as viteDefineConfig,
44
type ConfigEnv,
5+
type Plugin as VitestPlugin,
56
} from '@voidzero-dev/vite-plus-test/config';
7+
import type { OxfmtConfig } from 'oxfmt';
8+
import type { OxlintConfig } from 'oxlint';
9+
10+
import type { PackUserConfig } from './pack.ts';
11+
import type { RunConfig } from './run-config.ts';
12+
import type { StagedConfig } from './staged-config.ts';
13+
14+
declare module '@voidzero-dev/vite-plus-core' {
15+
interface UserConfig {
16+
/**
17+
* Options for oxlint
18+
*/
19+
lint?: OxlintConfig;
20+
21+
fmt?: OxfmtConfig;
22+
23+
pack?: PackUserConfig | PackUserConfig[];
24+
25+
run?: RunConfig;
26+
27+
staged?: StagedConfig;
28+
29+
// temporary solution to load plugins lazily
30+
// We need to support this in the upstream vite
31+
lazy?: () => Promise<{
32+
plugins?: VitestPlugin[];
33+
}>;
34+
}
35+
}
636

737
type ViteUserConfigFnObject = (env: ConfigEnv) => UserConfig;
838
type ViteUserConfigFnPromise = (env: ConfigEnv) => Promise<UserConfig>;

packages/cli/src/index.ts

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,4 @@
1-
import { type Plugin as VitestPlugin } from '@voidzero-dev/vite-plus-test/config';
2-
import type { OxfmtConfig } from 'oxfmt';
3-
import type { OxlintConfig } from 'oxlint';
4-
51
import { defineConfig } from './define-config.ts';
6-
import type { PackUserConfig } from './pack.ts';
7-
import type { RunConfig } from './run-config.ts';
8-
import type { StagedConfig } from './staged-config.ts';
9-
10-
declare module '@voidzero-dev/vite-plus-core' {
11-
interface UserConfig {
12-
/**
13-
* Options for oxlint
14-
*/
15-
lint?: OxlintConfig;
16-
17-
fmt?: OxfmtConfig;
18-
19-
pack?: PackUserConfig | PackUserConfig[];
20-
21-
run?: RunConfig;
22-
23-
staged?: StagedConfig;
24-
25-
// temporary solution to load plugins lazily
26-
// We need to support this in the upstream vite
27-
lazy?: () => Promise<{
28-
plugins?: VitestPlugin[];
29-
}>;
30-
}
31-
}
322

333
export * from '@voidzero-dev/vite-plus-core';
344

0 commit comments

Comments
 (0)