-
-
Notifications
You must be signed in to change notification settings - Fork 470
Pin Vite cache to project root and clear on update #374
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| '@open-slide/core': patch | ||
| --- | ||
|
|
||
| Store Vite's optimize-deps cache at the project root and clear it on in-app update, so upgrading no longer leaves the dev server failing on missing `.vite/deps` chunks. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| import path from 'node:path'; | ||
| import { describe, expect, it } from 'vitest'; | ||
| import { resolveViteCacheDir } from './cache-dir.ts'; | ||
|
|
||
| describe('resolveViteCacheDir', () => { | ||
| it('points at the user project root, not the installed core package', () => { | ||
| const cwd = path.join(path.sep, 'Users', 'david', 'slides'); | ||
| expect(resolveViteCacheDir(cwd)).toBe(path.join(cwd, 'node_modules', '.vite')); | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| import path from 'node:path'; | ||
|
|
||
| // Vite defaults its optimize-deps cache to `<nearest package.json>/node_modules/.vite`. | ||
| // Our `root` points inside the installed @open-slide/core package, so that default | ||
| // lands the cache under node_modules/@open-slide/core/node_modules/.vite — inside the | ||
| // very directory the in-app updater swaps out on upgrade, leaving Vite referencing | ||
| // chunks that no longer exist. Pin it to the user's project root instead. | ||
| export function resolveViteCacheDir(userCwd: string): string { | ||
| return path.join(userCwd, 'node_modules', '.vite'); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: 1weiho/open-slide
Length of output: 27346
🏁 Script executed:
Repository: 1weiho/open-slide
Length of output: 580
🏁 Script executed:
Repository: 1weiho/open-slide
Length of output: 588
Make cache invalidation unconditional after installation.
If
sync:skillsfails after the package install succeeds, execution never reachesclearViteCache(ctx.userCwd), leaving the new core package paired with stale optimized dependencies. Run cache cleanup from afinallyblock and normalizectx.userCwdusing the same resolved project root used by Vite config resolution; surface cleanup failures or inform the user that a manual restart is required.stability_and_availability
🧰 Tools
🪛 ast-grep (0.44.1)
[warning] Importing child_process exposes a command-execution surface; ensure any command/argument built from input is validated, and prefer execFile/spawn with an argument array over exec.
Context: import { spawn } from 'node:child_process';
Note: [CWE-78] Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection').
(detect-child-process-typescript)
🤖 Prompt for AI Agents