Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "migration-duplicate-imports",
"private": true,
"type": "module",
"devDependencies": {
"vite": "npm:@voidzero-dev/vite-plus-core@1.5.0",
"vite-plus": "1.5.0"
},
"packageManager": "pnpm@10.18.0"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[[case]]
name = "migration_duplicate_imports"
vp = "global"
steps = [
["vp", "migrate", "--no-interactive", "--no-hooks"],
{ argv = ["vpt", "print-file", "vite.config.ts"], comment = "Merge the rewritten type import into the existing value import (issue #3430)." },
]

[[case]]
name = "migration_duplicate_imports_preserve_code"
vp = "global"
steps = [
{ argv = ["vpt", "replace-file-content", "vite.config.ts", "import { defineConfig }", "const keep = 'keep';\nimport './setup';\nimport { defineConfig }"], snapshot = false },
{ argv = ["vpt", "write-file", "setup.ts", "export {};\n"], snapshot = false },
["vp", "migrate", "--no-interactive", "--no-hooks"],
{ argv = ["vpt", "print-file", "vite.config.ts"], comment = "Keep statements and side-effect imports between matching imports." },
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# migration_duplicate_imports

## `vp migrate --no-interactive --no-hooks`

```
VITE+ - The Unified Toolchain for the Web

◇ Updated . to Vite+ <version>
• Node <version> pnpm <version>
• Dependencies:
vite-plus 1.5.0 → <version>
vite → <version>
• 1 file had imports rewritten
• Package manager settings configured
```

## `vpt print-file vite.config.ts`

Merge the rewritten type import into the existing value import (issue #3430).

```
import { defineConfig, type Plugin } from 'vite-plus';

const noop = (): Plugin => ({ name: 'noop' });

export default defineConfig({
plugins: [noop()],
});
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# migration_duplicate_imports_preserve_code

## `vpt replace-file-content vite.config.ts 'import { defineConfig }' 'const keep = '\''keep'\'';
import '\''./setup'\'';
import { defineConfig }'`


## `vpt write-file setup.ts 'export {};
'`


## `vp migrate --no-interactive --no-hooks`

```
VITE+ - The Unified Toolchain for the Web

◇ Updated . to Vite+ <version>
• Node <version> pnpm <version>
• Dependencies:
vite-plus 1.5.0 → <version>
vite → <version>
• 1 file had imports rewritten
• Package manager settings configured
```

## `vpt print-file vite.config.ts`

Keep statements and side-effect imports between matching imports.

```
import type { Plugin } from 'vite-plus';
const keep = 'keep';
import './setup';
import { defineConfig } from 'vite-plus';

const noop = (): Plugin => ({ name: 'noop' });

export default defineConfig({
plugins: [noop()],
});
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import type { Plugin } from 'vite';
import { defineConfig } from 'vite-plus';

const noop = (): Plugin => ({ name: 'noop' });

export default defineConfig({
plugins: [noop()],
});
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ VITE+ - The Unified Toolchain for the Web
- Vitest v5: 1 review item

vite.config.ts
9:29 REVIEW [dynamic-config] Review this dynamic config; explicit v4 compatibility settings need manual insertion.
7:29 REVIEW [dynamic-config] Review this dynamic config; explicit v4 compatibility settings need manual insertion.
Docs: https://viteplus.dev/guide/vitest-v5#resolve-migration-findings
```

Expand All @@ -36,9 +36,7 @@ import { join } from 'node:path';

import react from '@vitejs/plugin-react';
import { playwright } from 'vite-plus/test/browser-playwright';
import { defineConfig, lazyPlugins } from 'vite-plus';

import type { UserConfigFn } from 'vite-plus';
import { defineConfig, type UserConfigFn, lazyPlugins } from 'vite-plus';

export default defineConfig(<UserConfigFn>(((() => {
return {
Expand Down
Loading
Loading