-
-
Notifications
You must be signed in to change notification settings - Fork 405
feat: module replacements v3 #2068
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
gameroman
wants to merge
103
commits into
npmx-dev:main
Choose a base branch
from
gameroman:module-replacements-v3
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
103 commits
Select commit
Hold shift + click to select a range
5ee3927
Update module-replacements dependency to 3.0.0-beta.0
gameroman 49dd770
Update [...pkg].get.ts
gameroman f276037
wip
gameroman e528c90
use a simpler approach
gameroman ad27978
revert
gameroman 59ac18c
wip
gameroman 6422b11
wip
gameroman 3ecebf0
Update use-replacement-dependencies.spec.ts
gameroman 7d4198b
Update use-replacement-dependencies.spec.ts
gameroman 1e94e2d
Update use-replacement-dependencies.spec.ts
gameroman 7ae1a63
Update use-replacement-dependencies.spec.ts
gameroman 8e8882b
Update Replacement.vue
gameroman 1c72e05
[autofix.ci] apply automated fixes
autofix-ci[bot] a36b4ce
Update Replacement.vue
gameroman 2464a08
Update Replacement.vue
gameroman d6f4b0b
update tests
gameroman 83102e3
Update use-compare-replacements.spec.ts
gameroman 363aa2a
Update use-compare-replacements.spec.ts
gameroman b30c0fd
Update use-compare-replacements.spec.ts
gameroman c1f52f2
Update use-compare-replacements.spec.ts
gameroman e346d83
Update a11y.spec.ts
gameroman f89546e
wip
gameroman 74eee66
Revert "wip"
gameroman a95b7a0
Update ReplacementSuggestion.vue
gameroman b60b234
Update ReplacementSuggestion.vue
gameroman 7207e50
Update en.json
gameroman 9e742ab
[autofix.ci] apply automated fixes
autofix-ci[bot] e365d7e
Update schema.json
gameroman 63417bf
create resolveReplacementUrl util
gameroman 93babd2
wip
gameroman 03584bd
don't render 'unknown'
gameroman 375bd0a
fix
gameroman 7ad1a05
Update Replacement.vue
gameroman bfd7ce1
Update schema.json
gameroman 2c69f4e
Update useCompareReplacements.ts
gameroman e16308c
Update useCompareReplacements.ts
gameroman 01d39ff
Merge branch 'main' into module-replacements-v3
gameroman 53aeaf6
fix: use url from mapping when provided
gameroman 3eeb9cf
fix: add missing imports
gameroman 0eda816
fix: update tests
gameroman 07bd1ba
fix: correctly format files
gameroman 25f99e6
fix
gameroman 55abc67
tests: add package replacement tests
gameroman fcd16fb
Merge branch 'main' into module-replacements-v3
gameroman c4ef9dd
fix: resolve git confilcts
gameroman f6161b8
Merge branch 'main' into module-replacements-v3
gameroman 6133408
Merge branch 'main' into module-replacements-v3
gameroman 0df272e
[autofix.ci] apply automated fixes
autofix-ci[bot] 227f7eb
Merge branch 'main' into module-replacements-v3
gameroman b86fbff
Merge branch 'main' into module-replacements-v3
gameroman 4041dbd
update module-replacements
gameroman 65d1a87
Use resolveDocUrl
gameroman bcf3ed9
3.0.0-beta.4
gameroman d1ca961
Merge branch 'main' into module-replacements-v3
gameroman 2f6de9e
revert incorrect i18n changes
gameroman 503f2ed
fix
gameroman ac522de
fix
gameroman 96accb3
Merge branch 'main' into module-replacements-v3
gameroman 46af065
use markdown
gameroman 12e1b56
[autofix.ci] apply automated fixes
autofix-ci[bot] fbed36b
revert markdown
gameroman 2782dc7
fix the bug and add e2e test
gameroman 1e5d9e3
[autofix.ci] apply automated fixes
autofix-ci[bot] f6838c5
remove double period
gameroman f44bec6
do test differently
gameroman 3f1fb7e
[autofix.ci] apply automated fixes
autofix-ci[bot] b9ddce5
wip
gameroman 2257ca3
update test
gameroman d80c709
use markdown
gameroman b0ef6d9
[autofix.ci] apply automated fixes
autofix-ci[bot] e4bcf9e
add data-testid
gameroman 4dec509
Merge branch 'main' into module-replacements-v3
gameroman ff85c99
[autofix.ci] apply automated fixes
autofix-ci[bot] e2a2a69
fix
gameroman be8378f
[autofix.ci] apply automated fixes
autofix-ci[bot] 221e572
wip
gameroman 5145d17
[autofix.ci] apply automated fixes
autofix-ci[bot] 50447c2
use markdown everywhere
gameroman ba4c9bd
fix
gameroman 06cf980
fix
gameroman 3b01e5e
wip
gameroman b1d49ce
[autofix.ci] apply automated fixes
autofix-ci[bot] ab45b57
use codeblock
gameroman 1c35f17
[autofix.ci] apply automated fixes
autofix-ci[bot] 64d3d68
fix
gameroman a36d2f3
[autofix.ci] apply automated fixes
autofix-ci[bot] 08a3a90
use different strategy
gameroman 34082cb
wip
gameroman d9d422a
[autofix.ci] apply automated fixes
autofix-ci[bot] aab96cc
wip
gameroman 02f622f
fix
gameroman e0fa80b
Merge branch 'main' into module-replacements-v3
gameroman fcb0088
update message
gameroman 604ff27
Merge branch 'npmx-dev:main' into module-replacements-v3
gameroman ccc0b2f
add `getReplacementDescription`
gameroman 91e8420
fix
gameroman 1edb531
Merge branch 'main' into module-replacements-v3
ghostdevv 14cb914
[autofix.ci] apply automated fixes
autofix-ci[bot] 91b46ba
Merge branch 'main' into module-replacements-v3
gameroman f6ae284
Merge branch 'main' into module-replacements-v3
gameroman 0a06767
update
gameroman 64f1aef
[autofix.ci] apply automated fixes
autofix-ci[bot] edfd26c
fix
gameroman 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| import type { ModuleReplacement } from 'module-replacements' | ||
| import type { ModuleReplacement, ModuleReplacementMapping } from 'module-replacements' | ||
|
|
||
| async function fetchReplacements( | ||
| deps: Record<string, string>, | ||
|
|
@@ -8,7 +8,11 @@ async function fetchReplacements( | |
| const results = await Promise.all( | ||
| names.map(async name => { | ||
| try { | ||
| const replacement = await $fetch<ModuleReplacement | null>(`/api/replacements/${name}`) | ||
| const response = await $fetch<{ | ||
| mapping: ModuleReplacementMapping | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @danielroe iirc you said these types are inferred based on the route. is that true? does this not infer them because of the interpolation? |
||
| replacement: ModuleReplacement | ||
| } | null>(`/api/replacements/${name}`) | ||
| const replacement = response?.replacement ?? null | ||
| return { name, replacement } | ||
| } catch { | ||
| return { name, replacement: null } | ||
|
|
||
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 |
|---|---|---|
| @@ -1,5 +1,7 @@ | ||
| import type { ModuleReplacement } from 'module-replacements' | ||
| import type { ModuleReplacement, ModuleReplacementMapping } from 'module-replacements' | ||
|
|
||
| export function useModuleReplacement(packageName: MaybeRefOrGetter<string>) { | ||
| return useLazyFetch<ModuleReplacement | null>(() => `/api/replacements/${toValue(packageName)}`) | ||
| return useLazyFetch<{ mapping: ModuleReplacementMapping; replacement: ModuleReplacement } | null>( | ||
| () => `/api/replacements/${toValue(packageName)}`, | ||
| ) | ||
| } |
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 |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| import type { ModuleReplacement } from 'module-replacements' | ||
|
|
||
| export function getReplacementDescription(replacement: ModuleReplacement): string { | ||
| if (replacement.type === 'documented') return '' | ||
| return replacement.description ?? '' | ||
| } | ||
|
|
||
| export function getReplacementNodeVersion(replacement: ModuleReplacement): string | null { | ||
| const nodeEngine = replacement.engines?.find(e => e.engine === 'nodejs') | ||
| return nodeEngine?.minVersion || null | ||
| } |
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
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.