Skip to content

refactor: enforce Rust dead code and visibility lints - #2564

Draft
fengmk2 wants to merge 2 commits into
mainfrom
refactor/rust-visibility-dead-code-hardening
Draft

refactor: enforce Rust dead code and visibility lints#2564
fengmk2 wants to merge 2 commits into
mainfrom
refactor/rust-visibility-dead-code-hardening

Conversation

@fengmk2

@fengmk2 fengmk2 commented Aug 26, 2026

Copy link
Copy Markdown
Member

Set dead_code and unreachable_pub to deny for the Rust workspace.

Reduce internal visibility across the CLI, NAPI binding, runtime, migration, snapshot, installer, and trampoline crates. Remove unused APIs and public re-exports. Keep JavaScript NAPI entry points crate-local with narrow test expectations.

Exclude the pinned rolldown/ source tree from the workspace lint policy. Cargo still builds it as a path dependency. The release build still links rolldown_binding into the same NAPI .node file. Read Cargo metadata from both workspace manifests so the toolchain build can still find oxc.

Use Rolldown's dependency settings after the workspace split. This changes infer from 0.19.0 to 0.22.0. It also disables the default features. Rolldown uses infer::get() only for in-memory asset MIME detection. The disabled features remove the unused cfb dependency and reduce binary size. Version 0.22.0 also changes detection for some formats.

Update CI and cargo shear commands for the workspace boundary. Add the Rust visibility rule to AGENTS.md.

@netlify

netlify Bot commented Aug 26, 2026

Copy link
Copy Markdown

Deploy Preview for viteplus-preview canceled.

Name Link
🔨 Latest commit cd26bba
🔍 Latest deploy log https://app.netlify.com/projects/viteplus-preview/deploys/6a8e5b7ae720d300081befbf

@netlify

netlify Bot commented Aug 26, 2026

Copy link
Copy Markdown

Deploy Preview for viteplus-preview canceled.

Name Link
🔨 Latest commit 6eb1972
🔍 Latest deploy log https://app.netlify.com/projects/viteplus-preview/deploys/6a8e5fb44834840007caa707

@fengmk2 fengmk2 added test: e2e Auto run e2e tests test: install-e2e run vite install e2e test test: create-e2e Run `vp create` e2e tests test: sfw preview-build Publish this PR's commits to the registry bridge as preview builds labels Aug 26, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Native binary sizes (6eb1972)

Final release artifacts built by the canonical build-upstream and build-windows-cli actions.

Artifact Format Base PR Change
vp (Linux x64) Binary 10.74 MiB 10.74 MiB 0 B (0.00%)
vp (Linux x64) gzip -9 4.64 MiB 4.64 MiB -22 B (-0.00%)
NAPI (Linux x64) Binary 32.21 MiB 32.16 MiB -56.00 KiB (-0.17%)
NAPI (Linux x64) gzip -9 12.69 MiB 12.67 MiB -25.82 KiB (-0.20%)
vp (macOS ARM64) Binary 8.03 MiB 8.03 MiB 0 B (0.00%)
vp (macOS ARM64) gzip -9 4.05 MiB 4.05 MiB +7 B (+0.00%)
NAPI (macOS ARM64) Binary 39.80 MiB 39.76 MiB -48.53 KiB (-0.12%)
NAPI (macOS ARM64) gzip -9 16.99 MiB 16.96 MiB -27.39 KiB (-0.16%)
vp (Windows x64) Binary 8.64 MiB 8.64 MiB 0 B (0.00%)
vp (Windows x64) gzip -9 3.77 MiB 3.77 MiB -68 B (-0.00%)
NAPI (Windows x64) Binary 27.05 MiB 27.00 MiB -48.00 KiB (-0.17%)
NAPI (Windows x64) gzip -9 10.76 MiB 10.73 MiB -28.11 KiB (-0.26%)
Trampoline (Windows x64) Binary 14.00 KiB 14.00 KiB 0 B (0.00%)
Trampoline (Windows x64) gzip -9 7.09 KiB 7.09 KiB 0 B (0.00%)
Installer (Windows x64) Binary 4.50 MiB 4.50 MiB 0 B (0.00%)
Installer (Windows x64) gzip -9 2.11 MiB 2.11 MiB -1 B (-0.00%)

@github-actions

Copy link
Copy Markdown
Contributor

Registry bridge build (6eb1972)

This commit build is published to the registry bridge, which serves these as ordinary npm versions (every other package proxies to npmjs):

Package Version
vite-plus 0.0.0-commit.6eb1972f19ea9da149ba8796846cf5b8223ae3a0
@voidzero-dev/vite-plus-core 0.0.0-commit.6eb1972f19ea9da149ba8796846cf5b8223ae3a0

Install the Vite+ CLI built from this commit, then migrate a project:

# macOS / Linux
curl -fsSL https://raw.githubusercontent.com/voidzero-dev/vite-plus/6eb1972f19ea9da149ba8796846cf5b8223ae3a0/packages/cli/install.sh | VP_PR_VERSION=2564 bash
# Windows (PowerShell)
$env:VP_PR_VERSION="2564"; irm https://raw.githubusercontent.com/voidzero-dev/vite-plus/6eb1972f19ea9da149ba8796846cf5b8223ae3a0/packages/cli/install.ps1 | iex

Or download the standalone Windows installer built from this commit:

Architecture Installer
x64 vp-setup-x86_64-pc-windows-msvc.exe
Arm64 vp-setup-aarch64-pc-windows-msvc.exe

GitHub requires you to sign in and downloads each installer as a ZIP artifact. Extract vp-setup.exe, then run it against this preview build:

.\vp-setup.exe --version "0.0.0-commit.6eb1972f19ea9da149ba8796846cf5b8223ae3a0" --registry "https://registry-bridge.viteplus.dev/"

After installing, upgrade the current project's vite-plus to this test build with:

vp migrate

Or point your package manager at the bridge registry https://registry-bridge.viteplus.dev/:

Package manager Registry config
npm / pnpm / Bun .npmrc: registry=https://registry-bridge.viteplus.dev/
Yarn (v2+) .yarnrc.yml: npmRegistryServer: "https://registry-bridge.viteplus.dev/"

Then pin the build (vite aliases to vite-plus-core; pnpm can use a catalog, npm an overrides entry):

{
  "devDependencies": {
    "vite-plus": "0.0.0-commit.6eb1972f19ea9da149ba8796846cf5b8223ae3a0",
    "vite": "npm:@voidzero-dev/vite-plus-core@0.0.0-commit.6eb1972f19ea9da149ba8796846cf5b8223ae3a0"
  }
}

@github-actions

Copy link
Copy Markdown
Contributor

🐳 Docker preview image

Built from this PR's registry bridge build:

Image Compressed size
ghcr.io/voidzero-dev/vite-plus:pr-2564 236MB
# remove any stale local copy from a previous run, then pull fresh
docker rmi ghcr.io/voidzero-dev/vite-plus:pr-2564 2>/dev/null; docker pull ghcr.io/voidzero-dev/vite-plus:pr-2564

Quick check:

docker run --rm ghcr.io/voidzero-dev/vite-plus:pr-2564 vp --version

See docs/guide/docker.md for usage.

@fengmk2 fengmk2 changed the title refactor: harden Rust visibility checks refactor: enforce Rust dead code and visibility lints Aug 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

preview-build Publish this PR's commits to the registry bridge as preview builds test: create-e2e Run `vp create` e2e tests test: e2e Auto run e2e tests test: install-e2e run vite install e2e test test: sfw

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant