Skip to content

Commit a97c6cd

Browse files
authored
Merge branch 'main' into fix-bug-831
2 parents 0f68087 + 9dd2c77 commit a97c6cd

24 files changed

Lines changed: 514 additions & 78 deletions

File tree

.github/renovate.json

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,25 @@
55
"packages/cli/snap-tests/**",
66
"packages/cli/snap-tests-global/**",
77
"packages/cli/snap-tests-todo/**",
8-
"bench/fixtures/**"
8+
"bench/fixtures/**",
9+
"rolldown/**",
10+
"rolldown-vite/**"
11+
],
12+
"packageRules": [
13+
{
14+
"matchPackageNames": ["vitest-dev"],
15+
"enabled": false
16+
},
17+
{
18+
"matchPackageNames": [
19+
"fspy",
20+
"vite_glob",
21+
"vite_path",
22+
"vite_str",
23+
"vite_task",
24+
"vite_workspace"
25+
],
26+
"enabled": false
27+
}
928
]
1029
}

.github/workflows/ci.yml

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,16 +70,21 @@ jobs:
7070
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
7171
- uses: ./.github/actions/clone
7272

73-
# Disable Windows Defender real-time scanning to speed up I/O-heavy builds (~30-50% faster)
74-
- name: Disable Windows Defender
73+
- name: Setup Dev Drive
7574
if: runner.os == 'Windows'
76-
shell: powershell
77-
run: Set-MpPreference -DisableRealtimeMonitoring $true
75+
uses: samypr100/setup-dev-drive@30f0f98ae5636b2b6501e181dfb3631b9974818d # v4.0.0
76+
with:
77+
drive-size: 12GB
78+
drive-format: ReFS
79+
env-mapping: |
80+
CARGO_HOME,{{ DEV_DRIVE }}/.cargo
81+
RUSTUP_HOME,{{ DEV_DRIVE }}/.rustup
7882
7983
- uses: oxc-project/setup-rust@d286d43bc1f606abbd98096666ff8be68c8d5f57 # v1.0.0
8084
with:
8185
save-cache: ${{ github.ref_name == 'main' }}
8286
cache-key: test
87+
target-dir: ${{ runner.os == 'Windows' && format('{0}/target', env.DEV_DRIVE) || '' }}
8388

8489
- run: rustup target add x86_64-unknown-linux-musl
8590
if: ${{ matrix.os == 'ubuntu-latest' }}
@@ -181,16 +186,21 @@ jobs:
181186
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
182187
- uses: ./.github/actions/clone
183188

184-
# Disable Windows Defender real-time scanning to speed up I/O-heavy builds (~30-50% faster)
185-
- name: Disable Windows Defender
189+
- name: Setup Dev Drive
186190
if: runner.os == 'Windows'
187-
shell: powershell
188-
run: Set-MpPreference -DisableRealtimeMonitoring $true
191+
uses: samypr100/setup-dev-drive@30f0f98ae5636b2b6501e181dfb3631b9974818d # v4.0.0
192+
with:
193+
drive-size: 12GB
194+
drive-format: ReFS
195+
env-mapping: |
196+
CARGO_HOME,{{ DEV_DRIVE }}/.cargo
197+
RUSTUP_HOME,{{ DEV_DRIVE }}/.rustup
189198
190199
- uses: oxc-project/setup-rust@d286d43bc1f606abbd98096666ff8be68c8d5f57 # v1.0.0
191200
with:
192201
save-cache: ${{ github.ref_name == 'main' }}
193202
cache-key: cli-e2e-test
203+
target-dir: ${{ runner.os == 'Windows' && format('{0}/target', env.DEV_DRIVE) || '' }}
194204

195205
- uses: oxc-project/setup-node@fdbf0dfd334c4e6d56ceeb77d91c76339c2a0885 # v1.0.4
196206

crates/vite_global_cli/src/commands/env/doctor.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const KNOWN_VERSION_MANAGERS: &[(&str, &str)] = &[
2222
];
2323

2424
/// Tools that should have shims
25-
const SHIM_TOOLS: &[&str] = &["node", "npm", "npx"];
25+
const SHIM_TOOLS: &[&str] = &["node", "npm", "npx", "vpx"];
2626

2727
/// Column width for left-side keys in aligned output
2828
const KEY_WIDTH: usize = 18;

docs/guide/fmt.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@ vp fmt . --write
2020

2121
Put formatting configuration directly in the `fmt` block in `vite.config.ts` so all your configuration stays in one place. We do not recommend using `.oxfmtrc.json` with Vite+.
2222

23+
For editors, point the formatter config path at `./vite.config.ts` so format-on-save uses the same `fmt` block:
24+
25+
```json
26+
{
27+
"oxc.fmt.configPath": "./vite.config.ts"
28+
}
29+
```
30+
2331
For the upstream formatter behavior and configuration reference, see the [Oxfmt docs](https://oxc.rs/docs/guide/usage/formatter.html).
2432

2533
```ts

docs/guide/ide-integration.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ When you create or migrate a project, Vite+ prompts whether you want editor conf
2424
```json
2525
{
2626
"editor.defaultFormatter": "oxc.oxc-vscode",
27+
"oxc.fmt.configPath": "./vite.config.ts",
2728
"editor.formatOnSave": true,
2829
"editor.formatOnSaveMode": "file",
2930
"editor.codeActionsOnSave": {
@@ -32,4 +33,4 @@ When you create or migrate a project, Vite+ prompts whether you want editor conf
3233
}
3334
```
3435

35-
This gives the project a shared default formatter and enables Oxc-powered fix actions on save. Vite+ uses `formatOnSaveMode: "file"` because Oxfmt does not support partial formatting.
36+
This gives the project a shared default formatter and enables Oxc-powered fix actions on save. Setting `oxc.fmt.configPath` to `./vite.config.ts` keeps editor format-on-save aligned with the `fmt` block in your Vite+ config. Vite+ uses `formatOnSaveMode: "file"` because Oxfmt does not support partial formatting.

packages/cli/bin/oxfmt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@ if (!process.argv.includes('--lsp')) {
1111
}
1212

1313
import { createRequire } from 'node:module';
14+
import { pathToFileURL } from 'node:url';
1415

1516
const require = createRequire(import.meta.url);
1617
const oxfmtBin = require.resolve('oxfmt/bin/oxfmt');
1718

18-
await import(oxfmtBin);
19+
await import(pathToFileURL(oxfmtBin).href);

packages/cli/bin/oxlint

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@ if (!process.argv.includes('--lsp')) {
1212

1313
import { createRequire } from 'node:module';
1414
import { dirname, join } from 'node:path';
15+
import { pathToFileURL } from 'node:url';
1516

1617
const require = createRequire(import.meta.url);
1718
const oxlintMainPath = require.resolve('oxlint');
1819
const oxlintBin = join(dirname(dirname(oxlintMainPath)), 'bin', 'oxlint');
1920

20-
await import(oxlintBin);
21+
await import(pathToFileURL(oxlintBin).href);

packages/cli/package.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,18 @@
11
{
22
"name": "vite-plus",
33
"version": "0.0.0",
4+
"description": "The Unified Toolchain for the Web",
5+
"homepage": "https://viteplus.dev/guide",
6+
"bugs": {
7+
"url": "https://github.com/voidzero-dev/vite-plus/issues"
8+
},
49
"license": "MIT",
10+
"author": "VoidZero Inc.",
11+
"repository": {
12+
"type": "git",
13+
"url": "git+https://github.com/voidzero-dev/vite-plus.git",
14+
"directory": "packages/cli"
15+
},
516
"bin": {
617
"oxfmt": "./bin/oxfmt",
718
"oxlint": "./bin/oxlint",
Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,47 @@
1-
[1]> oxfmt # should reject non-LSP usage
1+
[1]> node ../node_modules/vite-plus/bin/oxfmt # should reject non-LSP usage
22
This oxfmt wrapper is for IDE extension use only (--lsp mode).
33
To format your code, run: vp fmt
44

5-
[1]> oxfmt --help # should reject non-LSP usage
5+
[1]> node ../node_modules/vite-plus/bin/oxfmt --help # should reject non-LSP usage
66
This oxfmt wrapper is for IDE extension use only (--lsp mode).
77
To format your code, run: vp fmt
8+
9+
> node ../node_modules/vite-plus/bin/oxfmt --lsp --help # should exercise import path
10+
Usage: [-c=PATH] [PATH]...
11+
12+
Mode Options:
13+
--init Initialize `.oxfmtrc.json` with default values
14+
--migrate=SOURCE Migrate configuration to `.oxfmtrc.json` from specified source
15+
Available sources: prettier, biome
16+
--lsp Start language server protocol (LSP) server
17+
--stdin-filepath=PATH Specify the file name to use to infer which parser to use
18+
19+
Output Options:
20+
--write Format and write files in place (default)
21+
--check Check if files are formatted, also show statistics
22+
--list-different List files that would be changed
23+
24+
Config Options
25+
-c, --config=PATH Path to the configuration file (.json, .jsonc, .ts, .mts, .cts, .js,
26+
.mjs, .cjs)
27+
28+
Ignore Options
29+
--ignore-path=PATH Path to ignore file(s). Can be specified multiple times. If not
30+
specified, .gitignore and .prettierignore in the current directory are
31+
used.
32+
--with-node-modules Format code in node_modules directory (skipped by default)
33+
34+
Runtime Options
35+
--no-error-on-unmatched-pattern Do not exit with error when pattern is unmatched
36+
--threads=INT Number of threads to use. Set to 1 for using only 1 CPU core.
37+
38+
Available positional items:
39+
PATH Single file, path or list of paths. Glob patterns are also supported.
40+
(Be sure to quote them, otherwise your shell may expand them before
41+
passing.) Exclude patterns with `!` prefix like `'!**/fixtures/*.js'`
42+
are also supported. If not provided, current working directory is used.
43+
44+
Available options:
45+
-h, --help Prints help information
46+
-V, --version Prints version information
47+
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
{
2-
"ignoredPlatforms": ["win32"],
3-
"commands": ["oxfmt # should reject non-LSP usage", "oxfmt --help # should reject non-LSP usage"]
2+
"commands": [
3+
"node ../node_modules/vite-plus/bin/oxfmt # should reject non-LSP usage",
4+
"node ../node_modules/vite-plus/bin/oxfmt --help # should reject non-LSP usage",
5+
"node ../node_modules/vite-plus/bin/oxfmt --lsp --help # should exercise import path"
6+
]
47
}

0 commit comments

Comments
 (0)