vite-plus 0.3.3 → 1.0.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (147) hide show
  1. package/LICENSE +35 -146
  2. package/README.md +6 -4
  3. package/binding/index.cjs +58 -54
  4. package/binding/index.d.cts +36 -4
  5. package/dist/{agent-Cu6-tXIP.js → agent-DIwEez_1.js} +6 -5
  6. package/dist/bin.js +75 -35
  7. package/dist/config/bin.js +3 -3
  8. package/dist/constants-BAsBfS1J.js +356 -0
  9. package/dist/create/bin.js +19 -13
  10. package/dist/{define-config-IgzmnvvV.js → define-config-Bz6dc3fm.js} +165 -43
  11. package/dist/{define-config-D0mevyb3.cjs → define-config-CAeeMTvb.cjs} +179 -44
  12. package/dist/{define-config-DPNEJxPz.d.ts → define-config-Cf_5GHmY.d.ts} +71 -25
  13. package/dist/define-config.cjs +1 -1
  14. package/dist/define-config.d.ts +1 -1
  15. package/dist/define-config.js +1 -1
  16. package/dist/dist-BWiANxFS.js +8052 -0
  17. package/dist/{dist-BDYZP12R.js → dist-BsAzy8OW.js} +109 -105
  18. package/dist/documentation-DqcZSthV.js +11 -0
  19. package/dist/{editor-4sjlHmUh.js → editor-DWgrWTbN.js} +246 -159
  20. package/dist/index.cjs +1 -1
  21. package/dist/index.d.ts +1 -1
  22. package/dist/index.js +1 -1
  23. package/dist/{json-cULBl7Pi.js → json-JP24qHUF.js} +14 -6
  24. package/dist/lint-plugins.cjs +1 -1
  25. package/dist/migration/bin.js +3127 -18
  26. package/dist/migration/compat/worker.js +1 -1
  27. package/dist/{oxlint-plugin-config-BVqEe9KY.js → oxlint-plugin-config-B-P1a_0g.js} +1 -1
  28. package/dist/oxlint-plugin.js +9 -7
  29. package/dist/pack-bin.js +1 -1
  30. package/dist/{package-CHH8jWan.js → package-BrupPpWA.js} +6 -2
  31. package/dist/{vitest-ecosystem-BiRqcaRI.js → package-overrides-Dpn4scvN.js} +1 -7
  32. package/dist/{prompts-k14KgthC.js → prompts-BW7_fDGJ.js} +3 -4
  33. package/dist/{report-CK5TnTsr.js → report-NhQk8VHb.js} +1 -0
  34. package/dist/{resolve-vite-config-CTOTuqTi.js → resolve-vite-config-D3XIVT6s.js} +1 -1
  35. package/dist/{resolve-vite-config-BqvS2P98.js → resolve-vite-config-DcsMQaYy.js} +2 -2
  36. package/dist/staged/bin.js +1206 -3318
  37. package/dist/sync-versions/bin.js +4 -4
  38. package/dist/sync-versions/bin.mjs +17 -2
  39. package/dist/test/browser/context.js +1 -1
  40. package/dist/test/browser/providers/playwright/context.js +1 -1
  41. package/dist/test/browser/providers/preview/context.js +1 -1
  42. package/dist/test/browser-playwright/context.js +1 -1
  43. package/dist/test/browser-preview/context.js +1 -1
  44. package/dist/test/context.d.ts +2 -942
  45. package/dist/test/context.js +1 -1
  46. package/dist/test/internal/traces.js +1 -0
  47. package/dist/test/locators.d.ts +2 -294
  48. package/dist/test/matchers.d.ts +2 -29
  49. package/dist/test/mocker.d.ts +2 -0
  50. package/dist/test/mocker.js +1 -0
  51. package/dist/test/{browser-webdriverio/context.js → plugins/browser-context.d.ts} +1 -0
  52. package/dist/test/plugins/browser-context.js +1 -1
  53. package/dist/test/plugins/browser-locators.d.ts +2 -0
  54. package/dist/test/plugins/browser-playwright.d.ts +2 -0
  55. package/dist/test/plugins/browser-preview.d.ts +2 -0
  56. package/dist/test/plugins/browser.d.ts +2 -0
  57. package/dist/test/plugins/mocker-automock.d.ts +2 -0
  58. package/dist/test/plugins/mocker-browser.d.ts +2 -0
  59. package/dist/test/plugins/mocker-node.d.ts +2 -0
  60. package/dist/test/plugins/mocker-redirect.d.ts +2 -0
  61. package/dist/test/plugins/mocker-register.d.ts +2 -0
  62. package/dist/test/plugins/mocker-transforms.d.ts +2 -0
  63. package/dist/test/plugins/mocker.d.ts +2 -0
  64. package/dist/test/plugins/pretty-format.d.ts +2 -0
  65. package/dist/test/plugins/snapshot-environment.d.ts +2 -0
  66. package/dist/test/plugins/snapshot-manager.d.ts +2 -0
  67. package/dist/test/plugins/snapshot.d.ts +2 -0
  68. package/dist/test/plugins/spy.d.ts +2 -0
  69. package/dist/test/plugins/utils-constants.d.ts +2 -0
  70. package/dist/test/plugins/utils-diff.d.ts +2 -0
  71. package/dist/test/plugins/utils-display.d.ts +2 -0
  72. package/dist/test/plugins/utils-error.d.ts +2 -0
  73. package/dist/test/plugins/utils-helpers.d.ts +2 -0
  74. package/dist/test/plugins/utils-offset.d.ts +2 -0
  75. package/dist/test/plugins/utils-resolver.d.ts +2 -0
  76. package/dist/test/plugins/utils-serialize.d.ts +2 -0
  77. package/dist/test/plugins/utils-source-map-node.d.ts +2 -0
  78. package/dist/test/plugins/utils-source-map.d.ts +2 -0
  79. package/dist/test/plugins/utils-timers.d.ts +2 -0
  80. package/dist/test/plugins/utils.d.ts +2 -0
  81. package/dist/toolchain.js +11 -11
  82. package/dist/toolchain.json +11 -11
  83. package/dist/{tsconfig-euB-GmIE.js → tsconfig-DESFDzWP.js} +1 -1
  84. package/dist/{tsconfig-C3h9CVTA.js → tsconfig-piorpNV7.js} +8 -4
  85. package/dist/version.js +5 -3
  86. package/dist/versions.js +6 -6
  87. package/dist/vitest-ecosystem-BU0AqZq-.js +23 -0
  88. package/dist/vitest-v5-entry-points-DthU1e_O.js +25 -0
  89. package/docs/config/fmt.md +4 -2
  90. package/docs/config/lint.md +4 -2
  91. package/docs/config/run.md +62 -26
  92. package/docs/guide/automatic-data-tracking.md +20 -15
  93. package/docs/guide/cache.md +12 -8
  94. package/docs/guide/check.md +2 -0
  95. package/docs/guide/commit-hooks.md +8 -1
  96. package/docs/guide/env.md +18 -13
  97. package/docs/guide/fmt.md +6 -2
  98. package/docs/guide/index.md +1 -1
  99. package/docs/guide/install.md +1 -1
  100. package/docs/guide/lint.md +5 -1
  101. package/docs/guide/local-cli.md +3 -3
  102. package/docs/guide/migrate-rules.md +58 -12
  103. package/docs/guide/migrate.md +86 -20
  104. package/docs/guide/monorepo.md +7 -1
  105. package/docs/guide/run.md +3 -1
  106. package/docs/guide/test.md +2 -0
  107. package/docs/guide/troubleshooting.md +3 -3
  108. package/docs/guide/vitest-v5.md +221 -0
  109. package/package.json +64 -87
  110. package/bin/oxfmt +0 -33
  111. package/bin/oxlint +0 -38
  112. package/dist/cli-truncate-Bg3RDXpi.js +0 -865
  113. package/dist/constants-C2dTOTe-.js +0 -80
  114. package/dist/dist-Dqv1-Clg.js +0 -3
  115. package/dist/is-fullwidth-code-point-BUNlIICg.js +0 -8
  116. package/dist/log-update-CoW8Z4Dl.js +0 -491
  117. package/dist/semver-CaDAb8vV.js +0 -1400
  118. package/dist/strip-ansi-C3wrWz9t.js +0 -853
  119. package/dist/test/browser/providers/webdriverio/context.d.ts +0 -1
  120. package/dist/test/browser/providers/webdriverio/context.js +0 -1
  121. package/dist/test/browser/providers/webdriverio.d.ts +0 -77
  122. package/dist/test/browser/providers/webdriverio.js +0 -1
  123. package/dist/test/browser-webdriverio/context.d.ts +0 -1
  124. package/dist/test/browser-webdriverio.d.ts +0 -77
  125. package/dist/test/browser-webdriverio.js +0 -1
  126. package/dist/test/coverage.d.ts +0 -2
  127. package/dist/test/coverage.js +0 -1
  128. package/dist/test/environments.d.ts +0 -2
  129. package/dist/test/environments.js +0 -1
  130. package/dist/test/plugins/browser-webdriverio.js +0 -1
  131. package/dist/test/plugins/expect.js +0 -1
  132. package/dist/test/plugins/runner-types.js +0 -1
  133. package/dist/test/plugins/runner-utils.js +0 -1
  134. package/dist/test/plugins/runner.js +0 -1
  135. package/dist/test/reporters.d.ts +0 -2
  136. package/dist/test/reporters.js +0 -1
  137. package/dist/test/runners.d.ts +0 -2
  138. package/dist/test/runners.js +0 -1
  139. package/dist/test/snapshot.d.ts +0 -2
  140. package/dist/test/snapshot.js +0 -1
  141. package/dist/test/suite.d.ts +0 -2
  142. package/dist/test/suite.js +0 -1
  143. package/dist/tsgolint-path-CbDReEOx.js +0 -34
  144. package/dist/tsgolint-path.d.ts +0 -7
  145. package/dist/tsgolint-path.js +0 -2
  146. package/dist/wrap-ansi-DNjkuBEp.js +0 -157
  147. package/dist/wrap-ansi-DUi52C6W.js +0 -2
@@ -0,0 +1,221 @@
1
+ # Upgrade to Vitest 5
2
+
3
+ Vite+ bundles Vitest `5.0.1`. Use Node `^22.18.0 || ^24.11.0 || >=26.0.0` for the CLI and tests.
4
+
5
+ ## Before you migrate
6
+
7
+ Run `vp migrate` from the workspace root before updating dependencies by hand. Keep the original lockfile and installed packages available so the migration can identify the source Vitest version, including the runner inside an older `vite-plus` installation.
8
+
9
+ Upgrade projects older than Vitest 4 to v4 before running this migration. If the original version cannot be determined, restore and install the original lockfile, then rerun `vp migrate`.
10
+
11
+ ```bash
12
+ vp migrate
13
+ vp install
14
+ vp check
15
+ vp test
16
+ ```
17
+
18
+ Read the file-specific review report before committing the result. The migration stops before dependency updates for conflicting `test.api` and `test.browser.api` settings or removed runtime APIs without a supported replacement. Resolve these blockers and run the command again. You can finish safe edits with a successful exit status while review items remain.
19
+
20
+ You can keep equivalent static `test.api` and `test.browser.api` values, including objects with different property order or quote styles. The migration removes the redundant `browser.api`. Choose one configuration for conflicting values or expressions that need evaluation; v5 uses one API server.
21
+
22
+ ## Node runtime
23
+
24
+ The migration upgrades incompatible runtime pins to the nearest supported minimum before installing dependencies. For example, `20.19.0` becomes `22.18.0`, `24.10.0` becomes `24.11.0`, and `25.9.0` becomes `26.0.0`. Supported pins stay unchanged. Unresolved selectors still need review.
25
+
26
+ Keep your library's public `engines.node` contract separate from its test runtime. The migration does not change that contract. You do not need to review an engine range with a supported minimum, such as `>=22.19.0`, or a whole supported major, such as `24.x`. Use a concrete runtime pin at or above the supported minimum for that major.
27
+
28
+ The Node compatibility checks cover `.node-version`, `.nvmrc`, and the `engines.node`, `devEngines.runtime`, and `volta.node` declarations in `package.json`. Node versions in CI workflows, containers, and other files are outside the scope of these checks.
29
+
30
+ ## Preserve existing behavior
31
+
32
+ Preview builds link to the PR documentation site for Vite+ guidance. Release builds use `viteplus.dev`. Links to upstream Vitest documentation stay the same.
33
+
34
+ For v4 configs, the migration adds compatibility settings where you omitted the corresponding option. Explicit settings take precedence. Beside each added setting, you get a comment with the reason, guidance for adopting v5 behavior, and links to the cleanup checklist and the Vitest migration guide:
35
+
36
+ ```ts
37
+ test: {
38
+ // Vitest v4 compatibility: preserve mock call history.
39
+ // Remove after tests no longer rely on calls from setup or earlier tests.
40
+ // https://viteplus.dev/guide/vitest-v5#remove-unneeded-compatibility-settings
41
+ // https://vitest.dev/guide/migration/#clearmocks-is-enabled-by-default
42
+ clearMocks: false,
43
+ }
44
+ ```
45
+
46
+ | Added setting | Behavior to check before removing it |
47
+ | --------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- |
48
+ | [`test.clearMocks: false`](https://vitest.dev/guide/migration/#clearmocks-is-enabled-by-default) | Check assertions that depend on mock calls from setup, `beforeAll`, or earlier tests. V5 clears that history before each test. |
49
+ | [`test.sharedViteServer: false`](https://vitest.dev/guide/migration/#inline-projects-share-the-vite-server-by-default) | Check plugins and config hooks with a shared server. V5 initializes them once for eligible inline projects. |
50
+ | [Inline `extends: false`](https://vitest.dev/guide/migration/#inline-projects-inherit-the-root-config-by-default) | Check inherited root options, plugins, and setup files. V5 merges arrays, so avoid duplicate setup. |
51
+ | [`browser.locators.exact: false`](https://vitest.dev/guide/migration/#locators-are-strict-by-default) | Update locators for full, case-sensitive matches, or opt out on individual locators. |
52
+ | [Glob threshold `perFile: true`](https://vitest.dev/guide/migration/#glob-coverage-thresholds-no-longer-inherit-perfile) | Keep for per-file coverage enforcement. Remove to check matching files as a group. |
53
+ | [`fakeTimers.toNotFake: ['Temporal']`](https://vitest.dev/guide/migration/#fake-timers-and-setsystemtime-now-mock-temporal) | Check tests that use the global Temporal polyfill with fake timers. Remove only `Temporal` to use mocked time; retain other exclusions. |
54
+
55
+ New projects use v5 defaults. You may be able to remove some generated compatibility settings with no code changes or small, localized fixes. Follow the checks below before removing them. These options remain supported in v5; keep compatibility for now if removal requires extensive test changes.
56
+
57
+ The migration leaves your existing settings and comments untouched. It does not add comments to settings from an earlier migration, since it cannot distinguish those settings from your own choices. Repeated runs do not duplicate comments or restore comments you removed.
58
+
59
+ If your project has no test config, you can use the v5 defaults without a review prompt or a new compatibility config. Other migration steps, such as merging lint configuration, can create `vite.config.ts`; the v4 compatibility settings apply to that new config during the same migration.
60
+
61
+ After upgrading to v5, you can rerun `vp migrate` without reapplying v4 compatibility defaults, including in projects without a config. Finish the dependency installation before rerunning migration.
62
+
63
+ Resolve or save the first run's review report before discarding the original dependencies. Later runs use the current Vitest version and files, so they might not repeat reviews that depended on the original v4 behavior.
64
+
65
+ ### Remove unneeded compatibility settings
66
+
67
+ First, validate the migrated project with its compatibility settings intact. Then use the migration diff and the `Vitest v4 compatibility` comments to identify additions in root, workspace, and inline project configs. Leave pre-existing user settings and settings with an unclear origin unchanged.
68
+
69
+ Remove one added setting at a time. Check which value the project uses after removal, including inherited options, plugins, and setup files. First run the affected suites without code changes. Include browser and coverage runs where relevant; a passing Node suite does not validate browser locators. For `fakeTimers.toNotFake`, remove only the added `Temporal` entry and retain other exclusions.
70
+
71
+ You can make small, localized application, test, or setup fixes that preserve test intent, such as correcting a locator or adjusting mock setup in a few tests. Keep assertions and test coverage intact, and review any snapshot changes. If removal requires widespread test edits or shared setup refactoring, keep compatibility for now and record the follow-up work.
72
+
73
+ Keep a removal if the affected tests pass, run the same test set without new skips, and support the resulting behavior. Remove its generated comment too. Restore the setting and comment if validation still fails, required suites cannot run, or the result remains uncertain. Undo only cleanup-specific trial edits; preserve completed migration fixes and unrelated work. Distinguish a deferred rewrite from a setting you could not validate.
74
+
75
+ Passing tests do not prove that coverage enforcement is unchanged. Keep generated glob-threshold `perFile: true` settings unless you intend to switch from per-file thresholds to aggregate checking. An agent should request your approval for that change. See [Vitest's coverage threshold migration](https://vitest.dev/guide/migration/#glob-coverage-thresholds-no-longer-inherit-perfile).
76
+
77
+ After the individual checks, run the full validation suite with the accepted removals together. Report the config path, removal decision, code changes, validation commands and results, and any remaining work for each candidate. If you retain an option as a project choice, replace its compatibility comment with that reason.
78
+
79
+ ## Source changes
80
+
81
+ The migration uses syntax and import bindings for targeted edits. You get a review item for dynamic options, ambiguous wrappers, or a callback whose contract cannot accept `async`.
82
+
83
+ ```ts
84
+ // Before
85
+ test.sequential('result', () => {
86
+ expect(result).resolves.toBe(42);
87
+ });
88
+
89
+ // After
90
+ test('result', { concurrent: false }, async () => {
91
+ await expect(result).resolves.toBe(42);
92
+ });
93
+ ```
94
+
95
+ In browser tests, use `toMatchTextContent` for v4 string and regular-expression assertions. The v4 string matcher accepted partial text, so identical text in a fixture does not prove that you intended v5's exact match. Choose `toHaveTextContent` yourself if you want the new semantics.
96
+
97
+ Keep Node `@testing-library/jest-dom` assertions unchanged. In a mixed Node/browser package, the migration checks static project membership before renaming a matcher. You must review shared files, dynamic configs, and command-line browser overrides. Calls through `expect.element()` identify browser assertions without that ambiguity.
98
+
99
+ Await `render` from `vitest-browser-vue` and `vitest-browser-svelte` before querying its result. Replace `toThrow('')` and `toThrowError('')` with `/^$/` to keep assertions for an empty message.
100
+
101
+ For programmatic config loading, replace `{ viteConfig, vitestConfig }` destructuring with the return value from `resolveConfig()` and its `.test` property. Direct migrated `vitest list` commands get `--no-static-parse`; supported `Vitest.collect(filters, options)` calls get `{ staticParse: false }`. Keep an explicit static-parse choice if you want v5's static collection.
102
+
103
+ ## Benchmarks
104
+
105
+ Use direct `bench` calls with inline, zero-argument callbacks or references to unchanged local functions. You can use dynamic names; the migration captures them once during registration. It preserves the workload callback and runs it through the v5 `bench` fixture inside a test. Simple `bench.skip`, `bench.only`, and `bench.todo` calls become the corresponding test modifiers. Calls inside ordinary `describe` and `suite` callbacks retain their surrounding scopes.
106
+
107
+ ```ts
108
+ // Before
109
+ import { bench } from 'vitest';
110
+ bench('parse', () => JSON.parse('{"value":1}'));
111
+
112
+ // After
113
+ import { test } from 'vitest';
114
+ test('parse', async ({ bench }) => {
115
+ await bench('parse', () => JSON.parse('{"value":1}')).run();
116
+ });
117
+ ```
118
+
119
+ Keep benchmark files matched by `benchmark.include`. The `vitest bench` and `vp test bench` commands remain supported. The migration does not remove them.
120
+
121
+ You can migrate built-in `benchmark.reporters` settings (`default` and `verbose`) and literal `benchmark.outputFile` or `benchmark.outputJson` paths to top-level reporters. Existing reporter destinations take precedence over a proposed move: resolve conflicting paths, terminal reporter choices, and JSON stdout consumers by hand. Project-specific settings, config merges, and custom or dynamic reporters also need review. In v5, regular tests and benchmarks share reporters.
122
+
123
+ For a literal command such as `vitest bench --outputJson=bench.json`, the migration selects the JSON reporter and keeps the file path. The v5 JSON report contains test results with per-test benchmarks. If you consume these reports outside Vitest, update readers that expect the v4 format.
124
+
125
+ Review calls with benchmark options, imported or reassigned callbacks, callback parameters, or wrappers. Baseline `compare` settings and `--compare` flags remain blockers. Set up per-benchmark result storage and an explicit comparison inside a test. See the [Vitest benchmark migration guide](https://vitest.dev/guide/migration/#benchmarking-api-rewrite) and [benchmarking guide](https://vitest.dev/guide/benchmarking) for replacements. Use `bench.compare()` if you need a comparison table across several workloads.
126
+
127
+ ## Entry points and packages
128
+
129
+ Use `vite-plus/test` for assertions and supported runner APIs. Keep coverage providers and `@vitest/ui` at the bundled runner's exact version, `5.0.1`. Keep `@vitest/web-worker` aligned when your project uses it.
130
+
131
+ | v4 import | v5 import or action |
132
+ | ---------------------------------------- | --------------------------------------------------------------------------- |
133
+ | `vitest/coverage`, `vitest/reporters` | `vite-plus/test/node` |
134
+ | `vitest/environments`, `vitest/snapshot` | `vite-plus/test/runtime` |
135
+ | `vitest/mocker` | `vite-plus/test/mocker` |
136
+ | `vitest/runners`, `vitest/suite` | Review `TestRunner` and its static methods from `vite-plus/test`. |
137
+ | Root-compatible `@vitest/expect` symbols | `vite-plus/test`; review unsupported helpers. |
138
+ | `@vitest/runner` | Migrate supported symbols to the root API and review the remaining imports. |
139
+ | `vitest/internal/module-runner` | Redesign the integration; no public replacement exists. |
140
+ | `@vitest/ws-client` | Retain if needed; upstream no longer adds v5 features. |
141
+
142
+ Vite+ 1.0 removes `vite-plus/test/coverage`, `/reporters`, `/environments`, and `/snapshot`. Run `vp migrate` to rewrite these existing Vite+ imports to the same `node` or `runtime` entries shown above. Vite+ retains `vite-plus/test/mocker` for the standalone `@vitest/mocker` API. It does not provide partial runner or expect plugin shims.
143
+
144
+ ## Community WebDriverIO provider
145
+
146
+ Vite+ 1.0 removes the `vite-plus/test/browser-webdriverio` exports. Use `@vitest/browser-webdriverio` and choose a provider version and framework peers that support your tests. The community maintains this package on its own release schedule.
147
+
148
+ `vp migrate` changes legacy provider imports to `@vitest/browser-webdriverio` and ensures a provider version of at least `5.0.0`. It adds `^5.0.0` when the provider is missing, upgrades older versions, and narrows ranges that still allow v4. It also updates referenced catalog entries and removes overrides that force an older provider. Versions and ranges already above this minimum stay unchanged. The migration ensures the required `webdriverio` peer is installed without upgrading an existing framework version.
149
+
150
+ For projects that use this provider, `vp migrate` adds an `@vitest/browser` override that matches the bundled Vitest version. Yarn uses `resolutions`. This prevents the provider's version range from retaining an older browser package in the lockfile.
151
+
152
+ You manage provider upgrades after this migration; Vite+ does not synchronize community releases with Vitest. Existing imports from the community package stay unchanged. For custom dependencies that the migrator cannot verify, resolve the diagnostic before retrying migration. See the [upstream package migration guide](https://vitest.dev/guide/migration/#package-migration).
153
+
154
+ Legacy Vite+ WebDriverIO `/context` imports move to `vite-plus/test/browser/context`. Keep runtime browser APIs on this shared entry; the community provider's `/context` entry contains types only.
155
+
156
+ The optional peer declaration still follows Vitest's dependency metadata. It does not provide a Vite+ export or synchronize provider releases.
157
+
158
+ ## Reports and screenshots
159
+
160
+ The migration does not edit or report changes that affect only title formatting, report output, artifact paths, or dependency deprecation. It leaves regular reporter settings unchanged and does not add `stdout: true`. Removed benchmark APIs and flags still need migration so commands can run.
161
+
162
+ If you consume generated reports or artifacts outside Vitest, check these paths. Keep old ignore entries while files remain in those directories. The migration adds `.vitest/` to `.gitignore` without deleting old entries.
163
+
164
+ | Output | v4 default | v5 default |
165
+ | ------------------- | ----------------------------- | ------------------------------------------ |
166
+ | Attachments | `.vitest-attachements/` | `.vitest/attachments/` |
167
+ | Failure screenshots | `__screenshots__/` | `.vitest/attachments/failure-screenshots/` |
168
+ | Blob reports | `.vitest-reports/blob-*.json` | `.vitest/blob/blob-*.json` |
169
+ | HTML | `html/index.html` | `.vitest/index.html` |
170
+ | JSON | stdout | `.vitest/json/output.json` |
171
+ | JUnit | stdout | `.vitest/junit/output.xml` |
172
+
173
+ HTML reporter options now use `outputDir` instead of the file-valued `outputFile`. Set `outputDir` yourself if you need a custom destination. Other reporters retain `outputFile` support. See the [upstream report changes](https://vitest.dev/guide/migration/#generated-reports-and-artifacts-use-the-vitest-directory).
174
+
175
+ Copy a custom `browser.screenshotDirectory` to `browser.expect.toMatchScreenshot.screenshotDirectory`. Review reference images before moving or regenerating them; v4 could save them in an unintended location. The default reference screenshot directory remains `__screenshots__`.
176
+
177
+ ## Resolve migration findings
178
+
179
+ Each Vitest v5 `BLOCK` or `REVIEW` item includes a `Docs` link. Follow the link for the relevant API change or migration rule. A blocker stops dependency updates; a review item requires you to check the result but does not stop safe edits.
180
+
181
+ For dynamic configs or shared files, determine the effective Vitest project settings before editing. Resolve config functions, spreads, and external inheritance, or make the compatibility changes by hand. Confirm which runner owns unimported globals in a mixed-runner project.
182
+
183
+ For parser failures or overlapping edits, keep the original file and apply the documented change by hand. Run `vp migrate` again after resolving the issue. A successful exit can still include review items; keep that report until you finish the manual changes.
184
+
185
+ ## Review checklist
186
+
187
+ Use the file locations in the migration report to review these changes. Run browser and coverage suites as well as Node tests.
188
+
189
+ For jest-dom matcher types, load `@testing-library/jest-dom/vitest` in `compilerOptions.types` or import it from a TypeScript setup file that your `tsconfig.json` includes. The root `@testing-library/jest-dom` type entry augments Jest. A JavaScript setup file excluded by `allowJs: false` does not load the Vitest augmentation for type checking. Review shared Jest/Vitest configs before changing their type entries.
190
+
191
+ With `vitest@5.0.1`, loading browser declarations first can also make TypeScript reject valid Node jest-dom assertions: `toHaveTextContent(/pattern/)` and CSS custom properties in `toHaveStyle()`. We reproduced this conflict with upstream imports and with Vite+ imports. Both `@testing-library/jest-dom@6.9.1` and `7.0.1` reproduce it. Check the declarations loaded by each test `tsconfig.json`; adding the jest-dom type entry alone might not resolve the conflict. Keep the affected project on the v4-based release until its Node and browser matcher types pass separate checks.
192
+
193
+ | Area | Required review |
194
+ | --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
195
+ | Test selection | Full names use `>` separators. Check name filters that span suite boundaries; plain single-segment filters do not need review. |
196
+ | Hoisted mocks | Move nested `vi.mock`, `vi.unmock`, and `vi.hoisted` calls to the top level after checking captured variables. |
197
+ | Browser automocks | Factory-free mocks retain mock defaults. Choose `{ spy: true }` if you need real implementations. |
198
+ | Constructor mocks | Check prototypes, methods, and `instanceof` for `vi.fn`, `vi.spyOn`, and `mockImplementation`. |
199
+ | Benchmarks | Review benchmark calls that the migration could not convert, comparison groups, and removed reporting options. Keep supported options such as `benchmark.enabled` and `benchmark.include`. |
200
+ | Async assertions | Await or return `resolves`, `rejects`, file snapshots, polls, and browser assertions. Review `expect.poll` timeouts without increasing them to hide failures. |
201
+ | Matcher types | Update old `Assertion<T>`, `Matchers<T>`, and `jest.Matchers` declarations for return and received type parameters. |
202
+ | Browser commands | Accept `SerializedLocator` objects instead of selector strings. |
203
+ | Browser UI | Use Vitest's printed URLs, including UI tokens and orchestrator `sessionId`. Check headed/headless screenshots at fixed viewports. |
204
+ | Project configuration | Check dynamic projects, root-config merges, nested projects, and hooks that assume one server or config execution per project. |
205
+ | Test collection | Review dynamic command wrappers and programmatic `collect()` calls whose static-parse options need manual edits. |
206
+ | Coverage | Compare v4/v5 resolved file sets for configured `coverage.include` and `coverage.exclude`. Relative-path matching can change the measured set. |
207
+ | Worker IDs | Review arithmetic and indexing based on `VITEST_POOL_ID` or `VITEST_WORKER_ID`; IDs start at 1. |
208
+ | Custom environments | Restore `populateGlobal().originals` entries with `Object.defineProperty`; the map contains descriptors. |
209
+ | DOM globals | Check assignments in jsdom/happy-dom tests; global assignments also update the window. |
210
+ | Temporal | Review scopes that use Temporal and `vi.setSystemTime()`. `toNotFake` does not preserve behavior without fake timers. |
211
+ | Removed APIs | Replace unsupported runner and internal imports before updating packages. Type-only references still require review and type checks. |
212
+
213
+ ## Run below a config directory
214
+
215
+ Vitest v5 no longer searches parent directories for a config. From a subdirectory, pass both the parent config and the intended test directory:
216
+
217
+ ```bash
218
+ vp test --config ../vite.config.ts --dir .
219
+ ```
220
+
221
+ See the [upstream Vitest 5 migration guide](https://vitest.dev/guide/migration/) for API examples and the new benchmark design.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite-plus",
3
- "version": "0.3.3",
3
+ "version": "1.0.0-rc.1",
4
4
  "description": "The Unified Toolchain for the Web",
5
5
  "homepage": "https://viteplus.dev/guide",
6
6
  "bugs": {
@@ -14,8 +14,6 @@
14
14
  "directory": "packages/cli"
15
15
  },
16
16
  "bin": {
17
- "oxfmt": "./bin/oxfmt",
18
- "oxlint": "./bin/oxlint",
19
17
  "vp": "./bin/vp",
20
18
  "vpr": "./bin/vpr"
21
19
  },
@@ -141,35 +139,14 @@
141
139
  "types": "./dist/test/internal/browser.d.ts",
142
140
  "default": "./dist/test/internal/browser.js"
143
141
  },
144
- "./test/runners": {
145
- "types": "./dist/test/runners.d.ts",
146
- "default": "./dist/test/runners.js"
147
- },
148
- "./test/suite": {
149
- "types": "./dist/test/suite.d.ts",
150
- "default": "./dist/test/suite.js"
151
- },
152
- "./test/environments": {
153
- "types": "./dist/test/environments.d.ts",
154
- "default": "./dist/test/environments.js"
142
+ "./test/internal/traces": {
143
+ "default": "./dist/test/internal/traces.js"
155
144
  },
156
145
  "./test/config": {
157
146
  "types": "./dist/test/config.d.ts",
158
147
  "require": "./dist/test/config.cjs",
159
148
  "default": "./dist/test/config.js"
160
149
  },
161
- "./test/coverage": {
162
- "types": "./dist/test/coverage.d.ts",
163
- "default": "./dist/test/coverage.js"
164
- },
165
- "./test/reporters": {
166
- "types": "./dist/test/reporters.d.ts",
167
- "default": "./dist/test/reporters.js"
168
- },
169
- "./test/snapshot": {
170
- "types": "./dist/test/snapshot.d.ts",
171
- "default": "./dist/test/snapshot.js"
172
- },
173
150
  "./test/runtime": {
174
151
  "types": "./dist/test/runtime.d.ts",
175
152
  "default": "./dist/test/runtime.js"
@@ -178,6 +155,10 @@
178
155
  "types": "./dist/test/worker.d.ts",
179
156
  "default": "./dist/test/worker.js"
180
157
  },
158
+ "./test/mocker": {
159
+ "types": "./dist/test/mocker.d.ts",
160
+ "default": "./dist/test/mocker.js"
161
+ },
181
162
  "./test/browser-playwright": {
182
163
  "types": "./dist/test/browser-playwright.d.ts",
183
164
  "default": "./dist/test/browser-playwright.js"
@@ -210,22 +191,6 @@
210
191
  "types": "./dist/test/browser/providers/preview/context.d.ts",
211
192
  "default": "./dist/test/browser/providers/preview/context.js"
212
193
  },
213
- "./test/browser-webdriverio": {
214
- "types": "./dist/test/browser-webdriverio.d.ts",
215
- "default": "./dist/test/browser-webdriverio.js"
216
- },
217
- "./test/browser/providers/webdriverio": {
218
- "types": "./dist/test/browser/providers/webdriverio.d.ts",
219
- "default": "./dist/test/browser/providers/webdriverio.js"
220
- },
221
- "./test/browser-webdriverio/context": {
222
- "types": "./dist/test/browser-webdriverio/context.d.ts",
223
- "default": "./dist/test/browser-webdriverio/context.js"
224
- },
225
- "./test/browser/providers/webdriverio/context": {
226
- "types": "./dist/test/browser/providers/webdriverio/context.d.ts",
227
- "default": "./dist/test/browser/providers/webdriverio/context.js"
228
- },
229
194
  "./test/browser/context": {
230
195
  "types": "./dist/test/browser/context.d.ts",
231
196
  "default": "./dist/test/browser/context.js"
@@ -252,129 +217,141 @@
252
217
  "types": "./dist/test/browser-compat.d.ts",
253
218
  "default": "./dist/test/browser-compat.js"
254
219
  },
255
- "./test/plugins/runner": {
256
- "default": "./dist/test/plugins/runner.js"
257
- },
258
- "./test/plugins/runner-utils": {
259
- "default": "./dist/test/plugins/runner-utils.js"
260
- },
261
- "./test/plugins/runner-types": {
262
- "default": "./dist/test/plugins/runner-types.js"
263
- },
264
220
  "./test/plugins/utils": {
221
+ "types": "./dist/test/plugins/utils.d.ts",
265
222
  "default": "./dist/test/plugins/utils.js"
266
223
  },
267
224
  "./test/plugins/utils-source-map": {
225
+ "types": "./dist/test/plugins/utils-source-map.d.ts",
268
226
  "default": "./dist/test/plugins/utils-source-map.js"
269
227
  },
270
228
  "./test/plugins/utils-source-map-node": {
229
+ "types": "./dist/test/plugins/utils-source-map-node.d.ts",
271
230
  "default": "./dist/test/plugins/utils-source-map-node.js"
272
231
  },
273
232
  "./test/plugins/utils-error": {
233
+ "types": "./dist/test/plugins/utils-error.d.ts",
274
234
  "default": "./dist/test/plugins/utils-error.js"
275
235
  },
276
236
  "./test/plugins/utils-helpers": {
237
+ "types": "./dist/test/plugins/utils-helpers.d.ts",
277
238
  "default": "./dist/test/plugins/utils-helpers.js"
278
239
  },
279
240
  "./test/plugins/utils-display": {
241
+ "types": "./dist/test/plugins/utils-display.d.ts",
280
242
  "default": "./dist/test/plugins/utils-display.js"
281
243
  },
282
244
  "./test/plugins/utils-timers": {
245
+ "types": "./dist/test/plugins/utils-timers.d.ts",
283
246
  "default": "./dist/test/plugins/utils-timers.js"
284
247
  },
285
248
  "./test/plugins/utils-offset": {
249
+ "types": "./dist/test/plugins/utils-offset.d.ts",
286
250
  "default": "./dist/test/plugins/utils-offset.js"
287
251
  },
288
252
  "./test/plugins/utils-resolver": {
253
+ "types": "./dist/test/plugins/utils-resolver.d.ts",
289
254
  "default": "./dist/test/plugins/utils-resolver.js"
290
255
  },
291
256
  "./test/plugins/utils-serialize": {
257
+ "types": "./dist/test/plugins/utils-serialize.d.ts",
292
258
  "default": "./dist/test/plugins/utils-serialize.js"
293
259
  },
294
260
  "./test/plugins/utils-constants": {
261
+ "types": "./dist/test/plugins/utils-constants.d.ts",
295
262
  "default": "./dist/test/plugins/utils-constants.js"
296
263
  },
297
264
  "./test/plugins/utils-diff": {
265
+ "types": "./dist/test/plugins/utils-diff.d.ts",
298
266
  "default": "./dist/test/plugins/utils-diff.js"
299
267
  },
300
268
  "./test/plugins/spy": {
269
+ "types": "./dist/test/plugins/spy.d.ts",
301
270
  "default": "./dist/test/plugins/spy.js"
302
271
  },
303
- "./test/plugins/expect": {
304
- "default": "./dist/test/plugins/expect.js"
305
- },
306
272
  "./test/plugins/snapshot": {
273
+ "types": "./dist/test/plugins/snapshot.d.ts",
307
274
  "default": "./dist/test/plugins/snapshot.js"
308
275
  },
309
276
  "./test/plugins/snapshot-environment": {
277
+ "types": "./dist/test/plugins/snapshot-environment.d.ts",
310
278
  "default": "./dist/test/plugins/snapshot-environment.js"
311
279
  },
312
280
  "./test/plugins/snapshot-manager": {
281
+ "types": "./dist/test/plugins/snapshot-manager.d.ts",
313
282
  "default": "./dist/test/plugins/snapshot-manager.js"
314
283
  },
315
284
  "./test/plugins/mocker": {
285
+ "types": "./dist/test/plugins/mocker.d.ts",
316
286
  "default": "./dist/test/plugins/mocker.js"
317
287
  },
318
288
  "./test/plugins/mocker-node": {
289
+ "types": "./dist/test/plugins/mocker-node.d.ts",
319
290
  "default": "./dist/test/plugins/mocker-node.js"
320
291
  },
321
292
  "./test/plugins/mocker-browser": {
293
+ "types": "./dist/test/plugins/mocker-browser.d.ts",
322
294
  "default": "./dist/test/plugins/mocker-browser.js"
323
295
  },
324
296
  "./test/plugins/mocker-redirect": {
297
+ "types": "./dist/test/plugins/mocker-redirect.d.ts",
325
298
  "default": "./dist/test/plugins/mocker-redirect.js"
326
299
  },
327
300
  "./test/plugins/mocker-transforms": {
301
+ "types": "./dist/test/plugins/mocker-transforms.d.ts",
328
302
  "default": "./dist/test/plugins/mocker-transforms.js"
329
303
  },
330
304
  "./test/plugins/mocker-automock": {
305
+ "types": "./dist/test/plugins/mocker-automock.d.ts",
331
306
  "default": "./dist/test/plugins/mocker-automock.js"
332
307
  },
333
308
  "./test/plugins/mocker-register": {
309
+ "types": "./dist/test/plugins/mocker-register.d.ts",
334
310
  "default": "./dist/test/plugins/mocker-register.js"
335
311
  },
336
312
  "./test/plugins/pretty-format": {
313
+ "types": "./dist/test/plugins/pretty-format.d.ts",
337
314
  "default": "./dist/test/plugins/pretty-format.js"
338
315
  },
339
316
  "./test/plugins/browser": {
317
+ "types": "./dist/test/plugins/browser.d.ts",
340
318
  "default": "./dist/test/plugins/browser.js"
341
319
  },
342
320
  "./test/plugins/browser-context": {
321
+ "types": "./dist/test/plugins/browser-context.d.ts",
343
322
  "default": "./dist/test/plugins/browser-context.js"
344
323
  },
345
324
  "./test/plugins/browser-client": {
346
325
  "default": "./dist/test/plugins/browser-client.js"
347
326
  },
348
327
  "./test/plugins/browser-locators": {
328
+ "types": "./dist/test/plugins/browser-locators.d.ts",
349
329
  "default": "./dist/test/plugins/browser-locators.js"
350
330
  },
351
331
  "./test/plugins/browser-playwright": {
332
+ "types": "./dist/test/plugins/browser-playwright.d.ts",
352
333
  "default": "./dist/test/plugins/browser-playwright.js"
353
334
  },
354
- "./test/plugins/browser-webdriverio": {
355
- "default": "./dist/test/plugins/browser-webdriverio.js"
356
- },
357
335
  "./test/plugins/browser-preview": {
336
+ "types": "./dist/test/plugins/browser-preview.d.ts",
358
337
  "default": "./dist/test/plugins/browser-preview.js"
359
338
  }
360
339
  },
361
340
  "dependencies": {
362
- "@oxc-project/types": "=0.150.0",
341
+ "@oxc-project/types": "=0.151.0",
363
342
  "@oxlint/plugins": "=1.79.0",
364
- "@vitest/browser": "4.1.11",
365
- "@vitest/browser-preview": "4.1.11",
366
- "@vitest/expect": "4.1.11",
367
- "@vitest/mocker": "4.1.11",
368
- "@vitest/pretty-format": "4.1.11",
369
- "@vitest/runner": "4.1.11",
370
- "@vitest/snapshot": "4.1.11",
371
- "@vitest/spy": "4.1.11",
372
- "@vitest/utils": "4.1.11",
373
- "oxfmt": "=0.68.0",
374
- "oxlint": "=1.83.0",
375
- "oxlint-tsgolint": "=7.0.2001",
376
- "vite": "npm:@voidzero-dev/vite-plus-core@0.3.3",
377
- "vitest": "4.1.11"
343
+ "@vitest/browser": "5.0.1",
344
+ "@vitest/browser-preview": "5.0.1",
345
+ "@vitest/mocker": "5.0.1",
346
+ "@vitest/pretty-format": "5.0.1",
347
+ "@vitest/snapshot": "5.0.1",
348
+ "@vitest/spy": "5.0.1",
349
+ "@vitest/utils": "5.0.1",
350
+ "oxfmt": "=0.70.0",
351
+ "oxlint": "=1.85.0",
352
+ "oxlint-tsgolint": "=7.0.2003",
353
+ "vite": "npm:@voidzero-dev/vite-plus-core@1.0.0-rc.1",
354
+ "vitest": "5.0.1"
378
355
  },
379
356
  "devDependencies": {
380
357
  "@emnapi/core": "2.0.0-alpha.5",
@@ -384,9 +361,9 @@
384
361
  "@types/cross-spawn": "^6.0.6",
385
362
  "@types/semver": "^7.8.0",
386
363
  "@types/validate-npm-package-name": "^4.0.2",
387
- "@vitest/browser-playwright": "4.1.11",
388
- "@vitest/browser-webdriverio": "4.1.11",
389
- "@voidzero-dev/vite-plus-prompts": "0.3.3",
364
+ "@vitest/browser-playwright": "5.0.1",
365
+ "@vitest/browser-webdriverio": "5.0.0",
366
+ "@voidzero-dev/vite-plus-prompts": "1.0.0-rc.1",
390
367
  "bingo": "^0.9.3",
391
368
  "cac": "^7.0.0",
392
369
  "cross-spawn": "^7.0.5",
@@ -394,7 +371,7 @@
394
371
  "detect-newline": "^4.0.1",
395
372
  "glob": "^13.0.0",
396
373
  "jsonc-parser": "^3.3.1",
397
- "lint-staged": "^16.2.6",
374
+ "lint-staged": "^17.5.1",
398
375
  "minimatch": "^10.0.3",
399
376
  "nanotar": "^0.3.0",
400
377
  "picocolors": "^1.1.1",
@@ -405,8 +382,8 @@
405
382
  "zod": "^3.25.76"
406
383
  },
407
384
  "peerDependencies": {
408
- "@vitest/browser-playwright": "4.1.11",
409
- "@vitest/browser-webdriverio": "4.1.11"
385
+ "@vitest/browser-playwright": "5.0.1",
386
+ "@vitest/browser-webdriverio": "^5.0.0-beta.5 || >=5.0.0"
410
387
  },
411
388
  "peerDependenciesMeta": {
412
389
  "@vitest/browser-playwright": {
@@ -431,17 +408,17 @@
431
408
  ]
432
409
  },
433
410
  "engines": {
434
- "node": "^20.19.0 || ^22.18.0 || >=24.11.0"
411
+ "node": "^22.18.0 || ^24.11.0 || >=26.0.0"
435
412
  },
436
413
  "optionalDependencies": {
437
- "@voidzero-dev/vite-plus-darwin-arm64": "0.3.3",
438
- "@voidzero-dev/vite-plus-darwin-x64": "0.3.3",
439
- "@voidzero-dev/vite-plus-linux-arm64-gnu": "0.3.3",
440
- "@voidzero-dev/vite-plus-linux-arm64-musl": "0.3.3",
441
- "@voidzero-dev/vite-plus-linux-x64-gnu": "0.3.3",
442
- "@voidzero-dev/vite-plus-linux-x64-musl": "0.3.3",
443
- "@voidzero-dev/vite-plus-win32-x64-msvc": "0.3.3",
444
- "@voidzero-dev/vite-plus-win32-arm64-msvc": "0.3.3"
414
+ "@voidzero-dev/vite-plus-darwin-arm64": "1.0.0-rc.1",
415
+ "@voidzero-dev/vite-plus-darwin-x64": "1.0.0-rc.1",
416
+ "@voidzero-dev/vite-plus-linux-arm64-gnu": "1.0.0-rc.1",
417
+ "@voidzero-dev/vite-plus-linux-arm64-musl": "1.0.0-rc.1",
418
+ "@voidzero-dev/vite-plus-linux-x64-gnu": "1.0.0-rc.1",
419
+ "@voidzero-dev/vite-plus-linux-x64-musl": "1.0.0-rc.1",
420
+ "@voidzero-dev/vite-plus-win32-x64-msvc": "1.0.0-rc.1",
421
+ "@voidzero-dev/vite-plus-win32-arm64-msvc": "1.0.0-rc.1"
445
422
  },
446
423
  "scripts": {
447
424
  "build": "oxnode -C dev ./build.ts",
package/bin/oxfmt DELETED
@@ -1,33 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- // LSP-only wrapper for oxfmt.
4
- // This enables IDE extensions (e.g., oxc-vscode) to discover and start the LSP server.
5
- // Binary resolution follows the same approach as `src/resolve-fmt.ts`.
6
-
7
- const isLSP = process.argv.includes('--lsp');
8
- const isStdin = process.argv.some((arg) => arg.startsWith('--stdin-filepath'));
9
- if (!isLSP && !isStdin) {
10
- console.error('This oxfmt wrapper is for IDE extension use only (lsp or stdin mode).');
11
- console.error('To format your code, run: vp fmt');
12
- process.exit(1);
13
- }
14
-
15
- import { createRequire } from 'node:module';
16
- import { dirname, join } from 'node:path';
17
- import { pathToFileURL } from 'node:url';
18
- import pkg from '../package.json' with { type: 'json' };
19
-
20
- const require = createRequire(import.meta.url);
21
- const oxfmtMainPath = require.resolve('oxfmt');
22
- const oxfmtBin = join(dirname(dirname(oxfmtMainPath)), 'bin', 'oxfmt');
23
-
24
- // This allows oxfmt to load vite.config.ts.
25
- // For `vp check` and `vp fmt`, VP_VERSION is injected by
26
- // `merge_resolved_envs_with_version()` in `cli.rs`.
27
- process.env.VP_VERSION = pkg.version;
28
- // oxfmt reads vite.config.ts only for the `fmt` block, so skip the user's
29
- // Vite plugin factory (lazyPlugins) while the config evaluates.
30
- // Literal kept in sync with CONFIG_METADATA_ENV in src/utils/constants.ts
31
- // (this plain-JS bin can't import the bundled constant).
32
- process.env.VP_RESOLVING_CONFIG_METADATA ??= '1';
33
- await import(pathToFileURL(oxfmtBin).href);
package/bin/oxlint DELETED
@@ -1,38 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- // LSP-only wrapper for oxlint.
4
- // This enables IDE extensions (e.g., oxc-vscode) to discover and start the LSP server.
5
- // Binary resolution follows the same approach as `src/resolve-lint.ts`.
6
-
7
- if (!process.argv.includes('--lsp')) {
8
- console.error('This oxlint wrapper is for IDE extension use only (--lsp mode).');
9
- console.error('To lint your code, run: vp lint');
10
- process.exit(1);
11
- }
12
-
13
- import { createRequire } from 'node:module';
14
- import { dirname, join } from 'node:path';
15
- import { pathToFileURL } from 'node:url';
16
- import { resolveTsgolintExecutable } from '../dist/tsgolint-path.js';
17
- import pkg from '../package.json' with { type: 'json' };
18
-
19
- const require = createRequire(import.meta.url);
20
- const oxlintMainPath = require.resolve('oxlint');
21
- const oxlintBin = join(dirname(dirname(oxlintMainPath)), 'bin', 'oxlint');
22
- const tsgolintPackageJsonPath = require.resolve('oxlint-tsgolint/package.json');
23
- const tsgolintBin = resolveTsgolintExecutable(
24
- join(dirname(tsgolintPackageJsonPath), 'bin', 'tsgolint.js'),
25
- import.meta.url,
26
- );
27
-
28
- // This allows oxlint to load vite.config.ts.
29
- // For `vp check` and `vp lint`, VP_VERSION is injected by
30
- // `merge_resolved_envs_with_version()` in `cli.rs`.
31
- process.env.VP_VERSION = pkg.version;
32
- // oxlint reads vite.config.ts only for the `lint` block, so skip the user's
33
- // Vite plugin factory (lazyPlugins) while the config evaluates.
34
- // Literal kept in sync with CONFIG_METADATA_ENV in src/utils/constants.ts
35
- // (this plain-JS bin can't import the bundled constant).
36
- process.env.VP_RESOLVING_CONFIG_METADATA ??= '1';
37
- process.env.OXLINT_TSGOLINT_PATH ??= tsgolintBin;
38
- await import(pathToFileURL(oxlintBin).href);