-
Notifications
You must be signed in to change notification settings - Fork 237
fix(global): nest immutable package installs #2222
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
Open
liangmiQwQ
wants to merge
7
commits into
voidzero-dev:main
Choose a base branch
from
liangmiQwQ:liang/codex/global-install-subdirs
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
171bf77
refactor(global): nest immutable package installs
liangmiQwQ 8e9eac3
test(global): cover dynamic imports from managed packages
liangmiQwQ 92ef65d
test(global): make dynamic import fixture cross-platform
liangmiQwQ 4b4a0ce
wip
liangmiQwQ 27fc02f
handling
liangmiQwQ e7eb442
Merge branch 'main' into liang/codex/global-install-subdirs
liangmiQwQ 898d153
simplify
liangmiQwQ 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
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
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
9 changes: 9 additions & 0 deletions
9
crates/vite_cli_snapshots/tests/cli_snapshots/fixtures/global_install_dynamic_import/bin.js
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,9 @@ | ||
| #!/usr/bin/env node | ||
|
|
||
| import { dirname, join } from 'node:path'; | ||
| import { fileURLToPath, pathToFileURL } from 'node:url'; | ||
|
|
||
| const loadedModule = join(dirname(fileURLToPath(import.meta.url)), 'loaded.js'); | ||
| // Keep `#` unescaped to reproduce the old install layout's URL-fragment failure. | ||
| const loadedModuleUrl = pathToFileURL(loadedModule).href.replaceAll('%23', '#'); | ||
| await import(loadedModuleUrl); |
1 change: 1 addition & 0 deletions
1
...s/vite_cli_snapshots/tests/cli_snapshots/fixtures/global_install_dynamic_import/loaded.js
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 @@ | ||
| console.log('global dynamic import loaded'); |
8 changes: 8 additions & 0 deletions
8
...ite_cli_snapshots/tests/cli_snapshots/fixtures/global_install_dynamic_import/package.json
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,8 @@ | ||
| { | ||
| "name": "global-install-dynamic-import", | ||
| "version": "0.0.0", | ||
| "type": "module", | ||
| "bin": { | ||
| "global-install-dynamic-import": "./bin.js" | ||
| } | ||
| } |
11 changes: 11 additions & 0 deletions
11
...e_cli_snapshots/tests/cli_snapshots/fixtures/global_install_dynamic_import/snapshots.toml
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,11 @@ | ||
| [[case]] | ||
| name = "global_install_dynamic_import" | ||
| vp = "global" | ||
| comment = "Regression test for #2220: globally installed packages can dynamically import an absolute path inside their installation." | ||
| steps = [ | ||
| { argv = ["vp", "install", "-g", "."] }, | ||
| { argv = ["global-install-dynamic-import"] }, | ||
| ] | ||
| after = [ | ||
| { argv = ["vp", "remove", "-g", "global-install-dynamic-import"], continue-on-failure = true }, | ||
| ] |
19 changes: 19 additions & 0 deletions
19
...xtures/global_install_dynamic_import/snapshots/global_install_dynamic_import.md
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,19 @@ | ||
| # global_install_dynamic_import | ||
|
|
||
| Regression test for #2220: globally installed packages can dynamically import an absolute path inside their installation. | ||
|
|
||
| ## `vp install -g .` | ||
|
|
||
| ``` | ||
| VITE+ - The Unified Toolchain for the Web | ||
|
|
||
| info: Installing 1 global package with Node.js <version> | ||
| ✓ Installed global-install-dynamic-import 0.0.0 | ||
| Bins: global-install-dynamic-import | ||
| ``` | ||
|
|
||
| ## `global-install-dynamic-import` | ||
|
|
||
| ``` | ||
| global dynamic import loaded | ||
| ``` |
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.
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.
Uh oh!
There was an error while loading. Please reload this page.
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.
This problem seems already exposed after snap test migration (Node 20 / npm 10, environment changed) but it doesn't seems noticed.