-
-
Notifications
You must be signed in to change notification settings - Fork 7.7k
fix: replace runner-side path normalization with fetchModule-side resolve
#18361
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
Merged
sapphi-red
merged 42 commits into
vitejs:main
from
hi-ogawa:fix-normalize-url-in-fetchModule
Dec 24, 2024
Merged
Changes from 38 commits
Commits
Show all changes
42 commits
Select commit
Hold shift + click to select a range
0f1ca5b
fix(runner): normalize absolute path in fetchModule
hi-ogawa 1913865
test: add test
hi-ogawa de0a2f8
wip: windows
hi-ogawa 5e8e7ec
wip: windows
hi-ogawa 2c3170c
refactor: move normalization to fetchModule
hi-ogawa 3726ec3
chore: remove root
hi-ogawa f001b7d
chore: cleanup
hi-ogawa 8f8bc80
Merge branch 'main' into fix-normalize-url-in-fetchModule
hi-ogawa 4bf3d0a
test: resolve file url via plugin
hi-ogawa f35cacb
fix: no support `file://`
hi-ogawa d9e5dbb
Merge branch 'main' into fix-normalize-url-in-fetchModule
hi-ogawa b1236bf
debug
hi-ogawa d4059cd
chore: comment
hi-ogawa 0a50356
test: refactor out fs mock
hi-ogawa 8e510e0
test: revert isolate
hi-ogawa 75ab26e
Merge branch 'main' into fix-normalize-url-in-fetchModule
hi-ogawa 42a5eb4
chore: comment
hi-ogawa 975f597
Merge branch 'main' into fix-normalize-url-in-fetchModule
hi-ogawa 27060f8
cherry-pick https://github.com/vitejs/vite/pull/18421
hi-ogawa 768c935
test: cleanup
hi-ogawa d5ed954
chore: cleanup
hi-ogawa 08cd7d9
test: tweak
hi-ogawa ad91d63
chore: remove root
hi-ogawa 0855eb7
ci: debug preview-release
hi-ogawa 5350765
ci: more debug
hi-ogawa 2793b78
ci: tweak
hi-ogawa 2c3c408
Merge branch 'main' into fix-normalize-url-in-fetchModule
hi-ogawa b3e1e4f
Merge branch 'main' into fix-normalize-url-in-fetchModule
hi-ogawa 446fe6f
fix: deal with isExternalUrl
hi-ogawa 5a44730
test: revive resolveId test
hi-ogawa cfc4901
chore: cleanup
hi-ogawa 61679ab
chore: remove more
hi-ogawa a6d6e77
chore: more cleanup
hi-ogawa 0f39deb
Merge branch 'main' into fix-normalize-url-in-fetchModule
hi-ogawa 06d820e
chore: revert some
hi-ogawa 4e04d5c
chore: cleanup
hi-ogawa 92f53eb
docs: update
hi-ogawa bdfbe10
chore: optional root
hi-ogawa 901170c
docs: remove root
hi-ogawa feb14b0
chore: remove internal usages of root
hi-ogawa ff8b33c
chore: remove root in worker examples
hi-ogawa b1a1722
chore: keep this one though
hi-ogawa 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
6 changes: 5 additions & 1 deletion
6
packages/vite/src/node/ssr/runtime/__tests__/fixtures/dynamic-import.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 |
|---|---|---|
| @@ -1,16 +1,20 @@ | ||
| import path from 'node:path' | ||
| import * as staticModule from './simple' | ||
| import { pathToFileURL } from 'node:url' | ||
|
|
||
| export const initialize = async () => { | ||
| const nameRelative = './simple' | ||
| const nameAbsolute = '/fixtures/simple' | ||
| const nameAbsoluteExtension = '/fixtures/simple.js' | ||
| const absolutePath = path.join(import.meta.dirname, "simple.js") | ||
| const fileUrl = pathToFileURL(absolutePath) | ||
| return { | ||
| dynamicProcessed: await import('./simple'), | ||
| dynamicRelative: await import(nameRelative), | ||
| dynamicAbsolute: await import(nameAbsolute), | ||
| dynamicAbsoluteExtension: await import(nameAbsoluteExtension), | ||
| dynamicAbsoluteFull: await import(path.join(import.meta.dirname, "simple.js")), | ||
| dynamicAbsoluteFull: await import((process.platform === 'win32' ? '/@fs/' : '') + absolutePath), | ||
| dynamicFileUrl: await import(fileUrl), | ||
| static: staticModule, | ||
| } | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -71,6 +71,7 @@ export async function createModuleRunnerTester( | |
| } | ||
| }, | ||
| }, | ||
| ...(config.plugins ?? []), | ||
| ], | ||
| ...config, | ||
| }) | ||
|
|
||
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.
Since
rootis deprecated and does not need to be set anymore, I think we can removerootfrom all the examples and types in the docs.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.
Makes sense. Updated the docs and also removed the internal usages of root.
I kept the default server runner one since users can technically access it via
runner.options.root.