Skip to content

fix(implode): remove the env sourcing spellings that doctor accepts - #3708

Draft
fengmk2 wants to merge 2 commits into
mainfrom
feat/implode-shared-source-matcher
Draft

fengmk2 wants to merge 2 commits into
mainfrom
feat/implode-shared-source-matcher

Conversation

@fengmk2

@fengmk2 fengmk2 commented Dec 5, 2026 •

Copy link
Copy Markdown
Member

vp implode now removes the profile lines that source the Vite+ env file in the spellings that vp env doctor and first-use setup accept, such as:

  • [ -f "$HOME"/.vite-plus/env ] && . "$HOME"/.vite-plus/env
  • . ${HOME}/.vite-plus/env
  • source -- "$HOME/.vite-plus/env"

Implode reads each line with the shell-word matcher from #3660. It removes a line only when the line sources the env file on its own and each other command on it names the env file. Lines that continue a command, blocks that span lines, and lines with other commands stay, so cleanup does not break a profile or drop an unrelated command.

@fengmk2
fengmk2 added this pull request to stack #3709 December 5, 2026 17:15
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Dec 5, 2026 •

Copy link
Copy Markdown

Cloudflare builds and deploys previews for this pull request. Learn more about Cloudflare previews.

Worker Status Deployment Commit
viteplus-dev Deployed Preview 1b86b65

Updated: Dec 5, 2026, 17:49 UTC | Dashboard

Base automatically changed from triagebot/fix-3659 to main December 5, 2026 17:22
@fengmk2
fengmk2 force-pushed the feat/implode-shared-source-matcher branch from 90b680e to b66ad71 Compare December 5, 2026 17:22
`vp implode` matched only lines that start with `. ` or `source ` and
one argument, so it left lines such as
`[ -f "$HOME"/.vite-plus/env ] && . "$HOME"/.vite-plus/env`,
`. ${HOME}/.vite-plus/env` and `source -- "$HOME/.vite-plus/env"`.

Implode now selects lines with the shell-word matcher of
`vp env doctor` and first-use setup. It removes a line when the line
sources the env file on its own and each other command on it names the
env file. It keeps lines that continue a command, blocks that span
lines, and lines with other commands, so a removal cannot break the
profile.
@fengmk2
fengmk2 force-pushed the feat/implode-shared-source-matcher branch from b66ad71 to 008d213 Compare December 5, 2026 17:25
@github-actions

github-actions Bot commented Dec 5, 2026 •

Copy link
Copy Markdown
Contributor

CLI artifact sizes (1b86b65)

Final release artifacts built by the canonical build-upstream and build-windows-cli actions.
The dist rows use the Linux build. The core total excludes .node files to match the release artifact.

Artifact Format Base PR Change
packages/cli/dist Directory total 2.52 MiB 2.52 MiB 0 B (0.00%)
packages/core/dist Directory total 4.29 MiB 4.29 MiB 0 B (0.00%)
Combined package dist Directory total 6.81 MiB 6.81 MiB 0 B (0.00%)
vp (Linux x64) Binary 9.31 MiB 9.31 MiB +4.00 KiB (+0.04%)
vp (Linux x64) gzip -9 4.26 MiB 4.26 MiB +824 B (+0.02%)
NAPI (Linux x64) Binary 37.99 MiB 37.99 MiB 0 B (0.00%)
NAPI (Linux x64) gzip -9 15.33 MiB 15.33 MiB 0 B (0.00%)
vp (macOS ARM64) Binary 6.12 MiB 6.12 MiB +16 B (+0.00%)
vp (macOS ARM64) gzip -9 3.65 MiB 3.65 MiB +756 B (+0.02%)
NAPI (macOS ARM64) Binary 44.39 MiB 44.39 MiB 0 B (0.00%)
NAPI (macOS ARM64) gzip -9 19.42 MiB 19.42 MiB 0 B (0.00%)
vp (Windows x64) Binary 7.27 MiB 7.27 MiB +1.50 KiB (+0.02%)
vp (Windows x64) gzip -9 3.33 MiB 3.33 MiB +769 B (+0.02%)
NAPI (Windows x64) Binary 33.88 MiB 33.88 MiB 0 B (0.00%)
NAPI (Windows x64) gzip -9 14.04 MiB 14.04 MiB +1 B (+0.00%)
Trampoline (Windows x64) Binary 13.50 KiB 13.50 KiB 0 B (0.00%)
Trampoline (Windows x64) gzip -9 7.09 KiB 7.09 KiB -2 B (-0.03%)
Installer (Windows x64) Binary 4.70 MiB 4.70 MiB 0 B (0.00%)
Installer (Windows x64) gzip -9 2.25 MiB 2.25 MiB 0 B (0.00%)

Implode now keeps a sourcing line in a block that an earlier line
opens, such as the only command in a multi-line `if`, Fish `if` or
`function`, or Nushell braces. A pending `&&`, `||` or `|` now
continues across blank and comment lines, so the command after it
stays.

The shell-word splitter keeps `>&`, `<&`, `&>` and POSIX `>|` inside
the command, so `. "$HOME/.vite-plus/env" >/dev/null 2>&1` counts as one
command and implode removes it.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant