GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |
GeezerVison is showing github.com — fix(cache): fingerprint only whether files in node_modules/.bin exist by wan9chi · Pull Request #824 · voidzero-dev/vite-task Conversation
Member
Motivationpnpm's shims in Changes
🤖 Generated with Claude Code
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
wan9chi
force-pushed
the
claude/node-modules-bin-existence
branch
from
dc4a249 to
e93f942
Compare
|
There was an error while loading. Please reload this page.
fspy benchmarklinuxmacoswindows |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
e93f942 to
5421bbe
Compare
5421bbe to
39ce61e
Compare
## Motivation `vitest_browser_cache::vitest_browser_caches_inputs_and_restores_outputs` fails intermittently on Windows runners in the `Test (windows-ignored)` job: ``` Error: listen EACCES: permission denied ::1:63315 ``` 63315 is the fixed default port for Vitest browser mode's server. Windows reserves dynamic port ranges (Hyper-V/WinNAT excluded port ranges), and listening on a reserved port fails with `EACCES`. Vite only tries another port on `EADDRINUSE`, so the run fails, `dist/result.json` is never written, and the snapshot diverges. It depends on which runner the job lands on: it failed on #824 and #825 and passed on other runs of the same code. ## Changes The fixture's browser server now listens on port 0, so the OS chooses a free port. Vite supports `server.listen(0)` directly, but the config can't request it the normal way: - `test.api: { port: 0 }`: Vitest only copies `api.port` when it is truthy, so `0` falls back to 63315. - Setting `test.api` at all, even with a concrete port, adds an `API started at http://localhost:<port>/` banner line that would change the snapshot. `test.browser.api` prints a deprecation warning in Vitest 5. Instead, a small `enforce: 'post'` plugin sets `test.api.port = 0` after Vitest resolves `test.api`. The banner stays unchanged, and the snapshot is identical. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5.5 <[email protected]>
pnpm's bin shims embed the absolute workspace path in `NODE_PATH` and a `cmd-shim-target` comment, so any task that runs a dependency's executable missed after installing with the workspace at another path. What a shim runs is tracked through the package files the task reads, so the content of files directly inside `node_modules/.bin` is no longer hashed. Co-Authored-By: Claude Opus 5.5 <[email protected]>
39ce61e to
ec0eba1
Compare
There was an error while loading. Please reload this page.
#850) ## Motivation #823 hashes pnpm's `node_modules/.modules.yaml` without `prunedAt`, `storeDir`, `virtualStoreDir` and `linkedSkills`. What's left protects little and still causes needless misses: - Every cached `vite build` and `vitest` task reads the file because Vite reads it while resolving its config ([`packages/vite/src/node/server/index.ts`](https://github.com/vitejs/vite/blob/dce9fe69d37e957b62f3b5df61a761f7f2f949f5/packages/vite/src/node/server/index.ts#L1332-L1361)). Vite reads only `virtualStoreDir`, to add pnpm's global virtual store to the dev server's `server.fs.allow`, inside a try/catch for non-pnpm projects. `virtualStoreDir` is already left out of the hash, so the hash protects nothing Vite uses, and for `vite build` the file doesn't affect the output. - The other fields describe `node_modules`, which tasks already read. In pnpm 11 they are `hoistedDependencies`, `hoistPattern`, `publicHoistPattern`, `hoistedLocations`, `nodeLinker`, `included`, `skipped`, `injectedDeps`, `layoutVersion`, `virtualStoreDirMaxLength`, `pendingBuilds`, `ignoredBuilds`, `allowBuilds`, `packageManager` and `virtualStoreOnly`. When they change in a way that matters, the files a task reads in `node_modules` change too, and those reads are tracked. - Some of the hashed fields still vary across machines, so tasks missed with `'node_modules/.modules.yaml' modified`: - `packageManager`: the version of the pnpm that installed - `pendingBuilds`: filled after `pnpm install --ignore-scripts` - `virtualStoreOnly`: set after `pnpm fetch` - `skipped`: differs between glibc and musl for platform packages under the same cache key - The list of fields to leave out has to track pnpm's format. ## Changes - `node_modules/.modules.yaml` is now fingerprinted only by whether it exists, the same treatment #824 gives files in `node_modules/.bin`. A missing manifest still differs from an existing one, since tools detect pnpm by the file existing (Vite's try/catch, which-pm). - Trade-off: a task whose output depends on these fields without any file it reads in `node_modules` differing no longer misses. The examples #823 named are LavaMoat's allow-scripts check (`pendingBuilds`/`ignoredBuilds`), which-pm's pnpm version, and Nx's `hoistedDependencies`. These rarely run inside cached vp tasks, and in realistic cases `node_modules` differs too. - The JSON/YAML parsing, the canonical JSON writer and the fallback for unparsable content are removed, along with `vt`'s `serde_norway` dependency. Both files are hashed as empty content without being read, which is the hash files in `node_modules/.bin` already had, so their cache entries stay valid. - The `pnpm_modules_manifest` e2e fixture now shows that changing the manifest's content keeps the cache hit and removing it misses. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5.5 <[email protected]>
Vite+ 1.2 supports authenticated private npm registries and shows a new `vp run` summary that counts cache hits among cache-enabled tasks and reports successful tasks. It also verifies installer downloads, shows download progress in `vp upgrade`, and fixes task cache misses in pnpm projects and PowerShell exit status. ### Highlights - Support authenticated private npm registries ([#2624](#2624)), by @RSS1102. - The `vp run` summary now reads like `3/4 cache hit (75%), 9/10 successful, 2s saved.`: the cache hit rate leaves out tasks with caching disabled, and the count of successful tasks replaces the count of failed tasks ([vite-task#821](voidzero-dev/vite-task#821)), by @wan9chi. ### Features - The `install.sh` and `install.ps1` installers check each downloaded platform archive against the registry's SHA-512 `dist.integrity` before extracting it, and stop when the digest is missing or does not match ([#2949](#2949)), by @fengmk2. - `vp upgrade` shows a progress bar while it downloads the new platform package, instead of looking frozen on slow connections ([#2968](#2968)), by @kshanxs. - When a task is not cached because it wrote a file it also read, the summary says it `modified its inputs`, and `vp run --last-details` shows the `cache: { input, output }` exclusions that let it be cached. Detailed summaries show each cause of an error on its own line, and an invalid `--filter` glob reports its error once ([vite-task#783](voidzero-dev/vite-task#783), [vite-task#784](voidzero-dev/vite-task#784), [vite-task#761](voidzero-dev/vite-task#761), [vite-task#763](voidzero-dev/vite-task#763)), by @wan9chi. - The task runner can be built without file-access tracking on additional platforms. Tasks on those platforms must configure both `input` and `output` explicitly to be cached ([vite-task#829](voidzero-dev/vite-task#829)), by @mfechner. - Upgrade the bundled tools ([#2935](#2935), [#2977](#2977), [#2998](#2998), [#3021](#3021), [#3039](#3039)), by @voidzero-guard[bot] and @fengmk2: - `[email protected]` to `[email protected]`. - `[email protected]` to `[email protected]`. - `[email protected]` to `[email protected]`. - `[email protected]` to `[email protected]`. Vitest now turns on its on-disk caches by default, and `vp test` tasks run through `vp run` stay cacheable with them. - `[email protected]` to `[email protected]` and `[email protected]` to `[email protected]`. Oxfmt now also formats TOML in Markdown code blocks and frontmatter. The new lint and format versions can flag code that passed before, so run `vp fmt` after upgrading if CI runs `vp check`. - `vp migrate` keeps Prettier and continues the rest of the migration when the Prettier config uses a format the bundled Oxfmt cannot read, such as `.prettierrc.yml`. - `[email protected]` to `[email protected]`. Line disable comments apply to type-aware diagnostics again ([tsgolint#1271](oxc-project/tsgolint#1271)), so disable comments moved to the `} as T` line for v1.1.0 need to move back above the statement. - Projects that use `@effect/tsgo` need `@effect/[email protected]` or later with this tsgolint version. ### Fixes & Enhancements - Reinstalling dependencies with pnpm, or installing them at another path, no longer causes task cache misses, and tasks that run `pnpm run` or `pnpm exec` no longer miss the cache after pnpm rechecks dependencies ([vite-task#823](voidzero-dev/vite-task#823), [vite-task#824](voidzero-dev/vite-task#824), [vite-task#825](voidzero-dev/vite-task#825)), by @wan9chi. - On macOS, tasks with automatic file-access tracking can run Node.js single executable applications, such as pnpm 11's standalone binary, and `deno compile` outputs ([vite-task#840](voidzero-dev/vite-task#840)), by @wan9chi. - Cached tasks can run scripts whose shebang names an interpreter path longer than 126 bytes ([vite-task#788](voidzero-dev/vite-task#788)), by @lifeiscontent. - When a cache hit's outputs cannot be restored, `vp run` fails with an error suggesting `vp cache clean` instead of reporting a successful cache hit ([vite-task#770](voidzero-dev/vite-task#770)), by @wan9chi. - `vp run` no longer stops every task when concurrent tasks write to a full output pipe, such as a CI log collector ([vite-task#801](voidzero-dev/vite-task#801)), by @naokihaba. - On Linux, tasks with automatic file-access tracking start faster ([vite-task#817](voidzero-dev/vite-task#817)), by @wan9chi. - In PowerShell, a failing `vp` command sets `$?` to `False` and stops `&&` chains, as calling `vp.exe` directly does ([#2947](#2947)), by @fengmk2. - The Windows installer works when the PowerShell profile enables `Set-StrictMode`, and leaves the caller's strict mode unchanged ([#3005](#3005)), by @fengmk2. - Sourcing the Vite+ env script in POSIX shells is much faster with a long `PATH`, for example from 1.5 s to 6 ms in dash with 147 entries ([#2905](#2905)), by @jonykru. - Node.js version ranges from `.node-version`, `engines.node`, and `devEngines.runtime`, and package-manager version ranges, follow npm's semver rules ([#2835](#2835)), by @ryuapp. - `vp migrate` adds the `tsdown <0.23` compatibility settings (`deps.resolveDepSubpath` and `attw.profile`) only for projects on an older tsdown, so upgrades from Vite+ 1.x or `[email protected]` and later keep the modern defaults ([#2910](#2910)), by @fengmk2. - `vp create vite:generator` keeps the description prompt visible instead of drawing the spinner over it, uses concrete version ranges for dependencies missing from the workspace catalog, adds `rootDir: "src"` to the generated `tsconfig.json`, and scaffolds generators on `[email protected]` with Zod 4 option schemas ([#2940](#2940), [#2996](#2996), [#1831](#1831)), by @jong-kyung, @fengmk2, and @renovate[bot]. - `vp create` stops processing an organization template archive that expands past fixed size, compression ratio, or entry count limits ([#2950](#2950)), by @fengmk2. - `vp config` skips Git config writes that change nothing, so concurrent runs across linked worktrees no longer fail with `could not lock config file` after the first setup ([#2958](#2958)), by @naokihaba. - Git hooks no longer append the legacy `$VP_HOME/bin` or `~/.vite-plus/bin` directory to `PATH`. They use the inherited environment with the project's `node_modules/.bin` first, so projects without a local `vite-plus` dependency need the Vite+ bin directory on the Git client's `PATH` ([#2930](#2930)), by @liangmiQwQ. - Concurrent commands that need the same uninstalled Node.js version download it once; the others wait and reuse the installation ([#3024](#3024)), by @fengmk2. - `@voidzero-dev/vite-plus-core` declares the same `postcss`, optional `fsevents`, and Yuku parser ranges as the bundled Vite and tsdown, and `@oxlint/plugins` matches the bundled `oxlint` ([#2921](#2921)), by @fengmk2. - `vp pack --help` lists both default env prefixes, `VITE_PACK_` and `TSDOWN_` ([#3002](#3002)), by @jong-kyung. - Prompts and status lines use one space after status symbols ([#2928](#2928)), by @cpojer. ### Docs - Document shell completion, the global `-C` flag, the split directory layout, automatic update checks and how to opt out, package manager subcommands, and `vp env doctor` diagnostic scopes ([#2972](#2972), [#2956](#2956), [#2973](#2973), [#2960](#2960), [#2975](#2975), [#2982](#2982)), by @jong-kyung. - Clarify how `vp exec` and `vpx` resolve commands, how `vp test` selects its runner, how `vp config` treats existing Git hooks, what `vp check` needs for type checking, and how global CLI environment variables behave ([#2957](#2957), [#2979](#2979), [#2962](#2962), [#2978](#2978), [#2916](#2916), [#2919](#2919)), by @jong-kyung. - Correct migration prerequisites, minimum versions, and upgrade order, clarify tsup migration and staged configuration, fix local CLI installation without a global `vp`, and state the version requirements of `vp env uninstall` ([#2990](#2990), [#2923](#2923), [#2944](#2944), [#3004](#3004), [#2946](#2946)), by @jong-kyung. - Rename the install guide to Package Management, clarify package-management command compatibility, and align the create, run, and staged guides with CLI behavior and Vite Task defaults ([#2929](#2929), [#2925](#2925), [#2939](#2939), [#2941](#2941), [#2908](#2908)), by @jong-kyung. - Explain task cache behavior and how Vite build outputs are cached ([#2963](#2963), [#2942](#2942)), by @yusuke99 and @jong-kyung. - Correct the `baseUrl` and editor setup guidance in troubleshooting, and clarify JetBrains IDE support ([#2943](#2943), [#3001](#3001)), by @jong-kyung. - Note that `lazyPlugins` does not defer local module imports ([#2967](#2967)), by @kshanxs. - Align inline comments in code examples ([#2927](#2927)), by @yusuke99. ### Chore - Bump vite-task to `9ba4cc9`; its user-facing changes are listed above ([#3019](#3019)), by @wan9chi. - Speed up CI by removing platform waits, reusing native test binaries and dependency caches, skipping slow pnpm cache restores on macOS and Windows, and installing prebuilt `cargo-zigbuild` ([#2961](#2961), [#3023](#3023), [#3015](#3015), [#3010](#3010)), by @fengmk2. - Run CI bootstrap scripts without unpinned `tsx`, isolate upstream CLI help capture from workspace overrides, and update security-action to v1.0.10 ([#2948](#2948), [#2976](#2976), [#3022](#3022)), by @fengmk2. - Cache the docs build with the Vite Task remote cache ([#2926](#2926), [#2951](#2951)), by @wan9chi. - Add a Nix flake for the contributor development environment ([#2874](#2874), [#2974](#2974)), by @myuron and @fengmk2. - Stabilize the CLI help wrapping and browser snapshot tests ([#2952](#2952), [#3006](#3006)), by @myuron and @fengmk2. - Exclude upstream-managed dependencies from Renovate ([#2918](#2918)), by @fengmk2. - Refine the release-manager guidance ([#2917](#2917)), by @fengmk2. ### Bundled Versions | Tool | Version | Source | Changelog | | --------------- | ---------- | ------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | | vite | `8.3.4` | [`b6c20f6`](vitejs/vite@b6c20f6) | [8.3.4](https://github.com/vitejs/vite/releases/tag/v8.3.4) | | rolldown | `1.2.13` | [`f7de35f`](rolldown/rolldown@f7de35f) | [1.2.13](https://github.com/rolldown/rolldown/releases/tag/v1.2.13) | | tsdown | `0.23.1` | [npm](https://npmx.dev/package/tsdown/v/0.23.1) | [0.23.1](https://github.com/rolldown/tsdown/releases/tag/v0.23.1) | | vitest | `5.0.4` | [npm](https://npmx.dev/package/vitest/v/5.0.4) | [5.0.4](https://github.com/vitest-dev/vitest/releases/tag/v5.0.4) | | oxlint | `1.88.0` | [npm](https://npmx.dev/package/oxlint/v/1.88.0) | [1.88.0](https://github.com/oxc-project/oxc/releases/tag/oxlint_v1.88.0) | | oxlint-tsgolint | `7.0.2004` | [npm](https://npmx.dev/package/oxlint-tsgolint/v/7.0.2004) | [7.0.2004](https://github.com/oxc-project/tsgolint/releases/tag/v7.0.2004) | | oxfmt | `0.73.0` | [npm](https://npmx.dev/package/oxfmt/v/0.73.0) | [0.73.0](https://github.com/oxc-project/oxc/releases/tag/oxfmt_v0.73.0) | ### Upgrade ```bash vp upgrade ``` ### New Contributors @ryuapp @jonykru @myuron @kshanxs @mfechner **Full Changelog**: v1.1.0...v1.2.0 --- Merging this PR will trigger the release workflow. --------- Co-authored-by: voidzero-guard[bot] <278573678+voidzero-guard[bot]@users.noreply.github.com> Co-authored-by: MK (fengmk2) <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.